mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-31 21:14:48 -04:00
Add additional Sentry error capture and refine profile data update logic
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@compass/api",
|
||||
"version": "1.30.0",
|
||||
"version": "1.30.1",
|
||||
"private": true,
|
||||
"description": "Backend API endpoints",
|
||||
"main": "src/serve.ts",
|
||||
|
||||
@@ -134,6 +134,10 @@ export const validate = <T extends z.ZodTypeAny>(schema: T, val: unknown) => {
|
||||
if (issues.length > 0) {
|
||||
log.error(issues.map((i) => `${i.field}: ${i.context}`).join('\n'))
|
||||
}
|
||||
console.error('Validation failed', {issues, schema, val})
|
||||
Sentry.captureException(APIErrors.validationFailed(issues), {
|
||||
extra: {issues, schema, val},
|
||||
})
|
||||
throw APIErrors.validationFailed(issues)
|
||||
} else {
|
||||
return result.data as z.infer<T>
|
||||
|
||||
@@ -79,7 +79,7 @@ function ProfilePageInner(props: {user: User; profile: Profile}) {
|
||||
debug('parsedProfile', parsedProfile)
|
||||
const promises: Promise<any>[] = filterDefined([
|
||||
updateProfile(parsedProfile),
|
||||
baseUser && updateUser(baseUser),
|
||||
baseUser && updateUser({name: baseUser.name, username: baseUser.username}),
|
||||
interests && api('update-options', {table: 'interests', values: interests}),
|
||||
causes && api('update-options', {table: 'causes', values: causes}),
|
||||
work && api('update-options', {table: 'work', values: work}),
|
||||
|
||||
Reference in New Issue
Block a user