effect icon indicating copy to clipboard operation
effect copied to clipboard

add Cause.Annotated

Open tim-smart opened this issue 1 year ago • 8 comments

tim-smart avatar Sep 12 '24 05:09 tim-smart

🦋 Changeset detected

Latest commit: 9b4e7603c3310c0af8563947f78239fc3ad1d46f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster-browser Major
@effect/cluster-node Major
@effect/cluster-workflow Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc-http Major
@effect/rpc Major
@effect/schema Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-kysely Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Sep 12 '24 05:09 changeset-bot[bot]

@mikearnaldi This was an idea for a more flexible annotation system for Cause. Maybe something for 4.0?

tim-smart avatar Sep 12 '24 21:09 tim-smart

@mikearnaldi This was an idea for a more flexible annotation system for Cause. Maybe something for 4.0?

We used to have annotations but we removed them in favor of carrying the span in a proxy due to re-fail losing the span

mikearnaldi avatar Sep 12 '24 21:09 mikearnaldi

We used to have annotations but we removed them in favor of carrying the span in a proxy due to re-fail losing the span

This goes the route of a re-fail rehydrating the annotations.

tim-smart avatar Sep 12 '24 22:09 tim-smart

Will need to check the details but as far as I understand it's not really possible, spans are linked to a specific error, re-failing with a different error should not hydrate spans

mikearnaldi avatar Sep 12 '24 22:09 mikearnaldi

Will need to check the details but as far as I understand it's not really possible, spans are linked to a specific error, re-failing with a different error should not hydrate spans

When you annotate a Die or Fail, it will also add the annotations to the error object using a Proxy (like we do now). If during a re-fail it finds existing annotations, then it will re-add them to the cause.

tim-smart avatar Sep 12 '24 22:09 tim-smart

Will need to check the details but as far as I understand it's not really possible, spans are linked to a specific error, re-failing with a different error should not hydrate spans

When you annotate a Die or Fail, it will also add the annotations to the error object using a Proxy (like we do now). If during a re-fail it finds existing annotations, then it will re-add them to the cause.

but then why annotating the cause? what's the advantage, are we planning to add other kinds of annotations and if so those would also be lost on re-fail unless proxied?

mikearnaldi avatar Sep 13 '24 08:09 mikearnaldi

Will need to check the details but as far as I understand it's not really possible, spans are linked to a specific error, re-failing with a different error should not hydrate spans

When you annotate a Die or Fail, it will also add the annotations to the error object using a Proxy (like we do now). If during a re-fail it finds existing annotations, then it will re-add them to the cause.

if it re-checks then we might even be able to not annotate / proxy, we just check if the failure is === to the previous and we preserve annotations

mikearnaldi avatar Oct 01 '24 14:10 mikearnaldi