Skip to content

Commit

Permalink
🎨 Added logs, and improved debugging (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
abdheshnayak authored Dec 20, 2023
1 parent 9b1e1eb commit 6263ea3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
15 changes: 8 additions & 7 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ tasks:
interactive: true
cmds:
- |
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
COOKIE_DOMAIN=".kloudlite.io"
GATEWAY_URL="http://gateway.karthik-testing.svc.cluster.local"
case {{.app}} in
"auth")
PORT=4000
Expand Down Expand Up @@ -38,7 +39,7 @@ tasks:
;;
"vision")
URL_SUFFIX="-vision"
URL_SUFFIX=""
;;
*)
Expand All @@ -47,18 +48,18 @@ tasks:
esac
REMIX_DEV_ORIGIN="https://{{.app}}$URL_SUFFIX.dev.kloudlite.io"
REMIX_DEV_ORIGIN="https://{{.app}}$URL_SUFFIX.devc.kloudlite.io"
cp -r ./static/common/. ./public/
cp -r ./static/{{.app}}/. ./public/
case "{{.tscheck}}" in
"no")
URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev
GATEWAY_URL=$GATEWAY_URL URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev
;;
*)
URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev & pnpm typecheck
GATEWAY_URL=$GATEWAY_URL URL_SUFFIX=$URL_SUFFIX APP={{.app}} PORT=$PORT BASE_URL=$BASE_URL REMIX_DEV_ORIGIN=$REMIX_DEV_ORIGIN DEVELOPER=$(whoami) pnpm dev & pnpm typecheck
;;
esac
Expand Down Expand Up @@ -121,12 +122,12 @@ tasks:
case $(whoami) in
"bikash")
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
URL_SUFFIX=1
;;
"vision")
BASE_URL=dev.kloudlite.io
BASE_URL=devc.kloudlite.io
URL_SUFFIX="-vision"
;;
Expand Down
24 changes: 20 additions & 4 deletions lib/server/helpers/execute-query-with-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,25 @@ export const ExecuteQueryWithContext = (
query: print(q),
variables: variables || {},
},
timeout: 5000,
});

let { data,errors } = resp.data;
if(errors){
throw new Error(JSON.stringify(errors))
let { data } = resp.data;
const { errors } = resp.data;

if (errors) {
const e = errors as Error[];
if (e.length === 1) {
throw errors[0];
}

throw new Error(
e.reduce((acc, curr) => {
return `${acc}\n\n1. ${curr.name ? `${curr.name}:` : ''}:${
curr.message
}${curr.stack ? `\n${curr.stack}` : ''}`;
}, 'Errors:')
);
}

if (data) {
Expand All @@ -97,11 +111,13 @@ export const ExecuteQueryWithContext = (
}
return { ...resp.data, data };
} catch (err) {
console.error('ErrorIn:', apiName, err);
if ((err as AxiosError).response) {
console.error('ErrorIn:', apiName, (err as Error).name);
return (err as AxiosError).response?.data;
}

console.error('ErrorIn:', apiName, (err as Error).message);

return {
errors: [
{
Expand Down
2 changes: 2 additions & 0 deletions src/apps/auth/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const links = () => {
return [...baseLinks(), { rel: 'stylesheet', href: authStylesUrl }];
};

export { ErrorBoundary } from '~/lib/app-setup/root';

const Layout = ({ children }: ChildrenProps) => {
return (
// <SSRProvider>
Expand Down

0 comments on commit 6263ea3

Please sign in to comment.