Skip to content

Commit

Permalink
chore: update @comapeo/core to v2.3.1 (#43)
Browse files Browse the repository at this point in the history
* chore: update @comapeo/core to v2.3.1

* fix: fix notfound error checking
  • Loading branch information
gmaclennan authored Jan 23, 2025
1 parent 2b669b9 commit 3499a9f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 26 deletions.
56 changes: 33 additions & 23 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"typescript": "^5.6.3"
},
"dependencies": {
"@comapeo/core": "^2.1.0",
"@comapeo/core": "^2.3.1",
"@fastify/sensible": "^5.6.0",
"@fastify/websocket": "^10.0.1",
"@mapeo/crypto": "^1.0.0-alpha.10",
Expand Down
15 changes: 13 additions & 2 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,14 @@ export default async function routes(
*/
async function (req, reply) {
const { projectPublicId } = req.params
const project = await this.comapeo.getProject(projectPublicId)
console.log('projectPublicId', projectPublicId)
let project
try {
project = await this.comapeo.getProject(projectPublicId)
} catch (e) {
console.error(e)
throw e
}

await project.remoteDetectionAlert.create({
schemaName: 'remoteDetectionAlert',
Expand Down Expand Up @@ -464,7 +471,11 @@ async function ensureProjectExists(fastify, req) {
try {
await fastify.comapeo.getProject(req.params.projectPublicId)
} catch (e) {
if (e instanceof Error && e.message.startsWith('NotFound')) {
if (
e instanceof Error &&
// TODO: Add a better way to check for this error in @comapeo/core
(e.message.startsWith('NotFound') || e.message.match(/not found/iu))
) {
throw errors.projectNotFoundError()
}
throw e
Expand Down

0 comments on commit 3499a9f

Please sign in to comment.