From e976c45f888b8e45f0744c311eabc49a0e80c1d6 Mon Sep 17 00:00:00 2001 From: Dessalines <dessalines@users.noreply.github.com> Date: Thu, 2 Dec 2021 11:46:32 -0500 Subject: [PATCH] Using console.error for error logs. (#517) --- src/server/index.tsx | 4 +++- src/shared/components/common/image-upload-form.tsx | 1 + src/shared/components/common/markdown-textarea.tsx | 1 + src/shared/components/person/settings.tsx | 2 +- src/shared/components/post/post-form.tsx | 1 + src/shared/components/search.tsx | 2 +- src/shared/services/WebSocketService.ts | 2 +- 7 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/index.tsx b/src/server/index.tsx index 0fc3514..5bf79f1 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -90,6 +90,7 @@ server.get("/*", async (req, res) => { // Redirect to the 404 if there's an API error if (routeData[0] && routeData[0].error) { let errCode = routeData[0].error; + console.error(errCode); return res.redirect(`/404?err=${errCode}`); } @@ -174,7 +175,8 @@ server.get("/*", async (req, res) => { </html> `); } catch (err) { - console.log(err); + console.error(err); + return res.redirect(`/404?err=${err}`); } }); diff --git a/src/shared/components/common/image-upload-form.tsx b/src/shared/components/common/image-upload-form.tsx index 5e5f1e0..9b0fb84 100644 --- a/src/shared/components/common/image-upload-form.tsx +++ b/src/shared/components/common/image-upload-form.tsx @@ -104,6 +104,7 @@ export class ImageUploadForm extends Component< .catch(error => { i.state.loading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index d5ed4a9..ea5bea1 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -365,6 +365,7 @@ export class MarkdownTextArea extends Component< .catch(error => { i.state.imageLoading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 2678f9c..dff2959 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -796,7 +796,7 @@ export class Settings extends Component<any, SettingsState> { true ); } catch (err) { - console.log(err); + console.error(err); } }, 400), false diff --git a/src/shared/components/post/post-form.tsx b/src/shared/components/post/post-form.tsx index 22f78c3..f7b0581 100644 --- a/src/shared/components/post/post-form.tsx +++ b/src/shared/components/post/post-form.tsx @@ -565,6 +565,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> { .catch(error => { i.state.imageLoading = false; i.setState(i.state); + console.error(error); toast(error, "danger"); }); } diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 596b7e5..bf660ab 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -785,7 +785,7 @@ export class Search extends Component<any, SearchState> { choices.unshift({ value: "0", label: i18n.t("all") }); this.communityChoices.setChoices(choices, "value", "label", true); } catch (err) { - console.log(err); + console.error(err); } }, 400), false diff --git a/src/shared/services/WebSocketService.ts b/src/shared/services/WebSocketService.ts index ea5d3f6..87d8f97 100644 --- a/src/shared/services/WebSocketService.ts +++ b/src/shared/services/WebSocketService.ts @@ -27,7 +27,7 @@ export class WebSocketService { try { obs.next(JSON.parse(e.data.toString())); } catch (err) { - console.log(err); + console.error(err); } }) .onOpen(() => { -- 2.44.1