Effect CommunityEC
Effect Community2mo ago
26 replies
Nakumbo

Error with `catch` Callback Returning `unknown` in `Effect.tryPromise`

this is weird i have this

// Update project with metadata
yield* Effect.tryPromise({
try: () =>
db
.update(projects)
.set({
name: metadata.title,
description: metadata.description,
thumbnail: metadata.thumbnail,
videoMetadata: metadata,
videoUrl: youtubeUrl,
})
.where(eq(projects.id, projectId)),
catch: (error) =>
Effect.fail(
new DatabaseError({ operation: "update_project", cause: error })
),
});
and i getting this error
he 'catch' callback in Effect.tryPromise returns 'unknown'. The catch callback should be used to provide typed errors.
Consider wrapping unknown errors into Effect's Data.TaggedError for example, or narrow down the type to the specific error raised. effect(unknownInEffectCatch)effect(31)

but at the same time i have a bunch of places i did simalar things example
const timelineResults = yield* Effect.tryPromise({
try: () =>
db
.insert(timelines)
.values({
projectId,
name: result.clip.title,
duration: result.clip.duration,
})
.returning(),
catch: (error) =>
Effect.fail(
new DatabaseError({ operation: "create_timeline", cause: error })
),
});


and i have no errors in the rest ??
Was this page helpful?