Skip to content

Commit 0c88f78

Browse files
committed
remove TaggedError compat re-export, use TaggedErrorClass directly
1 parent 8686bda commit 0c88f78

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect-app": patch
3+
---
4+
5+
Remove `TaggedError` compatibility re-export, use `TaggedErrorClass` directly

packages/effect-app/src/Schema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { PhoneNumber as PhoneNumberT, type PhoneNumber as PhoneNumberType } from
88
import { extendM } from "./utils.js"
99

1010
export * from "effect/Schema"
11-
// v4: TaggedError renamed to TaggedErrorClass
12-
export { TaggedErrorClass as TaggedError } from "effect/Schema"
1311

1412
export * from "./Schema/Class.js"
1513
export { Class, TaggedClass } from "./Schema/Class.js"

packages/effect-app/src/client/errors.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @effect-diagnostics overriddenSchemaConstructor:skip-file */
2-
import { TaggedError } from "effect-app/Schema"
2+
import { TaggedErrorClass } from "effect-app/Schema"
33
import * as Cause from "effect/Cause"
44
import * as S from "../Schema.js"
55

@@ -21,7 +21,7 @@ export const tryToJson = (error: { toJSON(): unknown; toString(): string }) => {
2121

2222
// eslint-disable-next-line unused-imports/no-unused-vars
2323
// @ts-expect-error type not used
24-
export class NotFoundError<ItemType = string> extends TaggedError<NotFoundError<ItemType>>()("NotFoundError", {
24+
export class NotFoundError<ItemType = string> extends TaggedErrorClass<NotFoundError<ItemType>>()("NotFoundError", {
2525
type: S.String,
2626
id: S.Unknown
2727
}) {
@@ -42,7 +42,7 @@ export class NotFoundError<ItemType = string> extends TaggedError<NotFoundError<
4242
const messageFallback = (messageOrObject?: string | { message: string }) =>
4343
typeof messageOrObject === "object" ? messageOrObject : { message: messageOrObject ?? "" }
4444

45-
export class InvalidStateError extends TaggedError<InvalidStateError>()("InvalidStateError", {
45+
export class InvalidStateError extends TaggedErrorClass<InvalidStateError>()("InvalidStateError", {
4646
message: S.String
4747
}) {
4848
constructor(messageOrObject: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
@@ -56,7 +56,7 @@ export class InvalidStateError extends TaggedError<InvalidStateError>()("Invalid
5656
}
5757
}
5858

59-
export class ServiceUnavailableError extends TaggedError<ServiceUnavailableError>()("ServiceUnavailableError", {
59+
export class ServiceUnavailableError extends TaggedErrorClass<ServiceUnavailableError>()("ServiceUnavailableError", {
6060
message: S.String
6161
}) {
6262
constructor(messageOrObject: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
@@ -70,7 +70,7 @@ export class ServiceUnavailableError extends TaggedError<ServiceUnavailableError
7070
}
7171
}
7272

73-
export class ValidationError extends TaggedError<ValidationError>()("ValidationError", {
73+
export class ValidationError extends TaggedErrorClass<ValidationError>()("ValidationError", {
7474
errors: S.Array(S.Unknown)
7575
}) {
7676
constructor(
@@ -87,7 +87,7 @@ export class ValidationError extends TaggedError<ValidationError>()("ValidationE
8787
}
8888
}
8989

90-
export class NotLoggedInError extends TaggedError<NotLoggedInError>()("NotLoggedInError", {
90+
export class NotLoggedInError extends TaggedErrorClass<NotLoggedInError>()("NotLoggedInError", {
9191
message: S.String
9292
}) {
9393
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
@@ -101,7 +101,7 @@ export class NotLoggedInError extends TaggedError<NotLoggedInError>()("NotLogged
101101
/**
102102
* The user carries a valid Userprofile, but there is a problem with the login none the less.
103103
*/
104-
export class LoginError extends TaggedError<LoginError>()("NotLoggedInError", {
104+
export class LoginError extends TaggedErrorClass<LoginError>()("NotLoggedInError", {
105105
message: S.String
106106
}) {
107107
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
@@ -112,7 +112,7 @@ export class LoginError extends TaggedError<LoginError>()("NotLoggedInError", {
112112
}
113113
}
114114

115-
export class UnauthorizedError extends TaggedError<UnauthorizedError>()("UnauthorizedError", {
115+
export class UnauthorizedError extends TaggedErrorClass<UnauthorizedError>()("UnauthorizedError", {
116116
message: S.String
117117
}) {
118118
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
@@ -131,7 +131,7 @@ type OptimisticConcurrencyDetails = {
131131
readonly found?: string | undefined
132132
}
133133

134-
export class OptimisticConcurrencyException extends TaggedError<OptimisticConcurrencyException>()(
134+
export class OptimisticConcurrencyException extends TaggedErrorClass<OptimisticConcurrencyException>()(
135135
"OptimisticConcurrencyException",
136136
{ message: S.String }
137137
) {

packages/infra/test/fixtures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Effect, Layer, S, Scope, ServiceMap } from "effect-app"
22
import { NotLoggedInError, UnauthorizedError } from "effect-app/client"
33
import { RpcContextMap, RpcX } from "effect-app/rpc"
4-
import { TaggedError } from "effect-app/Schema"
4+
import { TaggedErrorClass } from "effect-app/Schema"
55

66
export class UserProfile extends ServiceMap.assignTag<UserProfile, UserProfile>("UserProfile")(
77
S.Class<UserProfile>("UserProfile")({
@@ -128,5 +128,5 @@ export const TestLive = Layer.effect(
128128
})
129129
)
130130

131-
export class CustomError1 extends TaggedError<CustomError1>()("CustomError1", {}) {}
132-
export class CustomError2 extends TaggedError<CustomError2>()("CustomError2", {}) {}
131+
export class CustomError1 extends TaggedErrorClass<CustomError1>()("CustomError1", {}) {}
132+
export class CustomError2 extends TaggedErrorClass<CustomError2>()("CustomError2", {}) {}

0 commit comments

Comments
 (0)