Skip to content

Commit

Permalink
fix error transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Mar 7, 2024
1 parent cfae0f6 commit affdaf0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"superjson": "^2.0.0",
"switch-pattern": "^0.2.1",
"systeminformation": "^5.21.12",
"trpc-nuxt": "^0.10.12",
"trpc-nuxt": "0.10.20",
"ts-enum-util": "^4.0.2",
"ts-mixer": "^6.0.3",
"ua-parser-js": "^1.0.36",
Expand Down
12 changes: 8 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/server/trpc/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export const t = initTRPC.context<Context>().create({
}

return {
...pick(shape, ['code', 'message']),
...shape,
// ...pick(shape, ['code', 'message']),
data: eData,
}
},
Expand Down
6 changes: 5 additions & 1 deletion src/store/session.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// import { TRPCClientError } from '@trpc/client'
// import { TRPC_ERROR_CODES_BY_KEY } from '@trpc/server/rpc'
import md5 from 'md5'
import { defineStore } from 'pinia'
import type { UserFull } from '~/def/user'
Expand Down Expand Up @@ -70,7 +72,9 @@ export const useSession = defineStore('session', {
return true
}
catch (err) {
// TODO: fix err is empty
// if (err instanceof TRPCClientError) {
// console.log(err.shape.code === TRPC_ERROR_CODES_BY_KEY.NOT_FOUND)
// }
this.$reset()
return false
}
Expand Down

0 comments on commit affdaf0

Please sign in to comment.