Skip to content

Commit

Permalink
Rename dashboards/location error details to make it easier to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
SARodrigues committed Mar 15, 2024
1 parent 3637451 commit 3c1903b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/error-message/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ErrorMessage extends PureComponent {
const errorCode = btoa(
JSON.stringify({
datetime: new Date(),
errors,
info: errors,
})
);

Expand Down
12 changes: 7 additions & 5 deletions pages/dashboards/[[...location]].js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const serverErrors = {
error: 504,
title: 'Network error | Global Forest Watch',
errorTitle: 'There was an error retrieving the data',
}
}
},
};

const ALLOWED_TYPES = ['global', 'country', 'aoi'];

Expand Down Expand Up @@ -247,7 +247,9 @@ export const getServerSideProps = async ({ params, query, req }) => {
};
} catch (err) {
let errorStatusCode = err?.response?.status;
if (!errorStatusCode) { errorStatusCode = 500 };
if (!errorStatusCode) {
errorStatusCode = 500;
}

let propsResponse = serverErrors[errorStatusCode];

Expand All @@ -256,9 +258,9 @@ export const getServerSideProps = async ({ params, query, req }) => {
...propsResponse,
debugErrors: userToken && {
token: userToken?.slice(-5) || '',
errors: err?.response?.data?.errors
errors: err?.response?.data?.errors,
},
}
};
}

return {
Expand Down

0 comments on commit 3c1903b

Please sign in to comment.