From: Dessalines Date: Thu, 2 Dec 2021 16:46:32 +0000 (-0500) Subject: Using console.error for error logs. (#517) X-Git-Url: http://these/git/?a=commitdiff_plain;h=e976c45f888b8e45f0744c311eabc49a0e80c1d6;p=lemmy-ui.git Using console.error for error logs. (#517) --- 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) => { `); } 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 { 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 { .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 { 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(() => {