Skip to content

Commit 036c491

Browse files
Simplify global Error diagnostic messages (#566)
1 parent 2274aef commit 036c491

5 files changed

Lines changed: 14 additions & 7 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@effect/language-service": patch
3+
---
4+
5+
Simplify diagnostic messages for global Error type usage
6+
7+
The diagnostic messages for `globalErrorInEffectCatch` and `globalErrorInEffectFailure` now use the more generic term "tagged errors" instead of "tagged errors (Data.TaggedError)" to provide cleaner, more concise guidance.

src/diagnostics/globalErrorInEffectCatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const globalErrorInEffectCatch = LSP.createDiagnostic({
6464
report({
6565
location: node.expression,
6666
messageText:
67-
`The 'catch' callback in ${nodeText} returns the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together.\nInstead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors.`,
67+
`The 'catch' callback in ${nodeText} returns the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together.\nInstead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors.`,
6868
fixes: []
6969
})
7070
}

src/diagnostics/globalErrorInEffectFailure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const globalErrorInEffectFailure = LSP.createDiagnostic({
4545
report({
4646
location: node,
4747
messageText:
48-
`Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors.`,
48+
`Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors.`,
4949
fixes: []
5050
})
5151
)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Effect.tryPromise
22
13:35 - 13:52 | 0 | The 'catch' callback in Effect.tryPromise returns the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together.
3-
Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectCatch)
3+
Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectCatch)
44

55
Effect.tryMapPromise
66
23:60 - 23:80 | 0 | The 'catch' callback in Effect.tryMapPromise returns the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together.
7-
Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectCatch)
7+
Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectCatch)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Effect.fail(new Error("global error"))
2-
7:28 - 7:66 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)
2+
7:28 - 7:66 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)
33

44
Effect.fail(new globalThis.Error("global error"))
5-
8:29 - 8:78 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)
5+
8:29 - 8:78 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)
66

77
Effect.fail(new BaseExtendsError())
8-
14:29 - 14:64 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)
8+
14:29 - 14:64 | 0 | Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors. effect(globalErrorInEffectFailure)

0 commit comments

Comments
 (0)