@effect/platform 0.82.8 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Error.js +60 -8
- package/dist/cjs/Error.js.map +1 -1
- package/dist/cjs/PlatformConfigProvider.js +1 -1
- package/dist/cjs/PlatformConfigProvider.js.map +1 -1
- package/dist/cjs/internal/fileSystem.js +8 -6
- package/dist/cjs/internal/fileSystem.js.map +1 -1
- package/dist/cjs/internal/keyValueStore.js +6 -6
- package/dist/cjs/internal/keyValueStore.js.map +1 -1
- package/dist/cjs/internal/path.js +6 -6
- package/dist/cjs/internal/path.js.map +1 -1
- package/dist/dts/Error.d.ts +54 -34
- package/dist/dts/Error.d.ts.map +1 -1
- package/dist/esm/Error.js +57 -7
- package/dist/esm/Error.js.map +1 -1
- package/dist/esm/PlatformConfigProvider.js +1 -1
- package/dist/esm/PlatformConfigProvider.js.map +1 -1
- package/dist/esm/internal/fileSystem.js +8 -6
- package/dist/esm/internal/fileSystem.js.map +1 -1
- package/dist/esm/internal/keyValueStore.js +6 -6
- package/dist/esm/internal/keyValueStore.js.map +1 -1
- package/dist/esm/internal/path.js +6 -6
- package/dist/esm/internal/path.js.map +1 -1
- package/package.json +2 -2
- package/src/Error.ts +76 -48
- package/src/PlatformConfigProvider.ts +1 -1
- package/src/internal/fileSystem.ts +10 -8
- package/src/internal/keyValueStore.ts +7 -7
- package/src/internal/path.ts +21 -15
- package/dist/cjs/internal/error.js +0 -20
- package/dist/cjs/internal/error.js.map +0 -1
- package/dist/dts/internal/error.d.ts +0 -2
- package/dist/dts/internal/error.d.ts.map +0 -1
- package/dist/esm/internal/error.js +0 -13
- package/dist/esm/internal/error.js.map +0 -1
- package/src/internal/error.ts +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.0",
|
|
4
4
|
"description": "Unified interfaces for common platform-specific services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"multipasta": "^0.2.5"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"effect": "^3.
|
|
19
|
+
"effect": "^3.16.0"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"provenance": true
|
package/src/Error.ts
CHANGED
|
@@ -4,32 +4,26 @@
|
|
|
4
4
|
import type * as Cause from "effect/Cause"
|
|
5
5
|
import * as Data from "effect/Data"
|
|
6
6
|
import * as Predicate from "effect/Predicate"
|
|
7
|
+
import * as Schema from "effect/Schema"
|
|
7
8
|
import type { Simplify } from "effect/Types"
|
|
8
|
-
import * as internal from "./internal/error.js"
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @since 1.0.0
|
|
12
12
|
* @category type id
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
14
|
+
export const TypeId: unique symbol = Symbol.for("@effect/platform/Error")
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @since 1.0.0
|
|
18
18
|
* @category type id
|
|
19
19
|
*/
|
|
20
|
-
export type
|
|
20
|
+
export type TypeId = typeof TypeId
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @since 1.0.0
|
|
24
24
|
* @category refinements
|
|
25
25
|
*/
|
|
26
|
-
export const isPlatformError = (u: unknown): u is PlatformError => Predicate.hasProperty(u,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @since 1.0.0
|
|
30
|
-
* @category error
|
|
31
|
-
*/
|
|
32
|
-
export type PlatformError = BadArgument | SystemError
|
|
26
|
+
export const isPlatformError = (u: unknown): u is PlatformError => Predicate.hasProperty(u, TypeId)
|
|
33
27
|
|
|
34
28
|
/**
|
|
35
29
|
* @since 1.0.0
|
|
@@ -56,70 +50,104 @@ export const TypeIdError = <const TypeId extends symbol, const Tag extends strin
|
|
|
56
50
|
|
|
57
51
|
/**
|
|
58
52
|
* @since 1.0.0
|
|
53
|
+
* @category Models
|
|
59
54
|
*/
|
|
60
|
-
export
|
|
55
|
+
export const Module = Schema.Literal(
|
|
56
|
+
"Clipboard",
|
|
57
|
+
"Command",
|
|
58
|
+
"FileSystem",
|
|
59
|
+
"KeyValueStore",
|
|
60
|
+
"Path",
|
|
61
|
+
"Stream",
|
|
62
|
+
"Terminal"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category Models
|
|
68
|
+
*/
|
|
69
|
+
export class BadArgument extends Schema.TaggedError<BadArgument>("@effect/platform/Error/BadArgument")("BadArgument", {
|
|
70
|
+
module: Module,
|
|
71
|
+
method: Schema.String,
|
|
72
|
+
description: Schema.optional(Schema.String),
|
|
73
|
+
cause: Schema.optional(Schema.Defect)
|
|
74
|
+
}) {
|
|
61
75
|
/**
|
|
62
76
|
* @since 1.0.0
|
|
63
|
-
* @category models
|
|
64
77
|
*/
|
|
65
|
-
|
|
66
|
-
readonly [PlatformErrorTypeId]: typeof PlatformErrorTypeId
|
|
67
|
-
readonly _tag: string
|
|
68
|
-
readonly module: "Clipboard" | "Command" | "FileSystem" | "KeyValueStore" | "Path" | "Stream" | "Terminal"
|
|
69
|
-
readonly method: string
|
|
70
|
-
readonly message: string
|
|
71
|
-
}
|
|
78
|
+
readonly [TypeId]: typeof TypeId = TypeId
|
|
72
79
|
|
|
73
80
|
/**
|
|
74
81
|
* @since 1.0.0
|
|
75
82
|
*/
|
|
76
|
-
|
|
83
|
+
get message(): string {
|
|
84
|
+
return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
/**
|
|
80
89
|
* @since 1.0.0
|
|
81
|
-
* @category
|
|
90
|
+
* @category Model
|
|
82
91
|
*/
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
export const SystemErrorReason = Schema.Literal(
|
|
93
|
+
"AlreadyExists",
|
|
94
|
+
"BadResource",
|
|
95
|
+
"Busy",
|
|
96
|
+
"InvalidData",
|
|
97
|
+
"NotFound",
|
|
98
|
+
"PermissionDenied",
|
|
99
|
+
"TimedOut",
|
|
100
|
+
"UnexpectedEof",
|
|
101
|
+
"Unknown",
|
|
102
|
+
"WouldBlock",
|
|
103
|
+
"WriteZero"
|
|
104
|
+
)
|
|
86
105
|
|
|
87
106
|
/**
|
|
88
107
|
* @since 1.0.0
|
|
89
|
-
* @category
|
|
108
|
+
* @category Model
|
|
90
109
|
*/
|
|
91
|
-
export
|
|
110
|
+
export type SystemErrorReason = typeof SystemErrorReason.Type
|
|
92
111
|
|
|
93
112
|
/**
|
|
94
113
|
* @since 1.0.0
|
|
95
|
-
* @category
|
|
114
|
+
* @category models
|
|
96
115
|
*/
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
export class SystemError extends Schema.TaggedError<SystemError>("@effect/platform/Error/SystemError")("SystemError", {
|
|
117
|
+
reason: SystemErrorReason,
|
|
118
|
+
module: Module,
|
|
119
|
+
method: Schema.String,
|
|
120
|
+
description: Schema.optional(Schema.String),
|
|
121
|
+
syscall: Schema.optional(Schema.String),
|
|
122
|
+
pathOrDescriptor: Schema.optional(Schema.Union(Schema.String, Schema.Number)),
|
|
123
|
+
cause: Schema.optional(Schema.Defect)
|
|
124
|
+
}) {
|
|
125
|
+
/**
|
|
126
|
+
* @since 1.0.0
|
|
127
|
+
*/
|
|
128
|
+
readonly [TypeId]: typeof TypeId = TypeId
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @since 1.0.0
|
|
132
|
+
*/
|
|
133
|
+
get message(): string {
|
|
134
|
+
return `${this.reason}: ${this.module}.${this.method}${
|
|
135
|
+
this.pathOrDescriptor !== undefined ? ` (${this.pathOrDescriptor})` : ""
|
|
136
|
+
}${this.description ? `: ${this.description}` : ""}`
|
|
137
|
+
}
|
|
138
|
+
}
|
|
109
139
|
|
|
110
140
|
/**
|
|
111
141
|
* @since 1.0.0
|
|
112
|
-
* @category
|
|
142
|
+
* @category Models
|
|
113
143
|
*/
|
|
114
|
-
export
|
|
115
|
-
readonly _tag: "SystemError"
|
|
116
|
-
readonly reason: SystemErrorReason
|
|
117
|
-
readonly syscall?: string | undefined
|
|
118
|
-
readonly pathOrDescriptor: string | number
|
|
119
|
-
}
|
|
144
|
+
export type PlatformError = BadArgument | SystemError
|
|
120
145
|
|
|
121
146
|
/**
|
|
122
147
|
* @since 1.0.0
|
|
123
|
-
* @category
|
|
148
|
+
* @category Models
|
|
124
149
|
*/
|
|
125
|
-
export const
|
|
150
|
+
export const PlatformError: Schema.Union<[
|
|
151
|
+
typeof BadArgument,
|
|
152
|
+
typeof SystemError
|
|
153
|
+
]> = Schema.Union(BadArgument, SystemError)
|
|
@@ -48,7 +48,7 @@ export const fromFileTree = (options?: {
|
|
|
48
48
|
const sourceError = (pathSegments: ReadonlyArray<string>, error: PlatformError) =>
|
|
49
49
|
ConfigError.SourceUnavailable(
|
|
50
50
|
[...pathSegments],
|
|
51
|
-
error.message,
|
|
51
|
+
error.description ?? error.message,
|
|
52
52
|
Cause.fail(error)
|
|
53
53
|
)
|
|
54
54
|
const pathNotFoundError = (pathSegments: ReadonlyArray<string>) =>
|
|
@@ -49,11 +49,12 @@ export const make = (
|
|
|
49
49
|
readFileString: (path, encoding) =>
|
|
50
50
|
Effect.tryMap(impl.readFile(path), {
|
|
51
51
|
try: (_) => new TextDecoder(encoding).decode(_),
|
|
52
|
-
catch: () =>
|
|
53
|
-
Error.BadArgument({
|
|
52
|
+
catch: (cause) =>
|
|
53
|
+
new Error.BadArgument({
|
|
54
54
|
module: "FileSystem",
|
|
55
55
|
method: "readFileString",
|
|
56
|
-
|
|
56
|
+
description: "invalid encoding",
|
|
57
|
+
cause
|
|
57
58
|
})
|
|
58
59
|
}),
|
|
59
60
|
stream: (path, options) =>
|
|
@@ -75,11 +76,12 @@ export const make = (
|
|
|
75
76
|
Effect.flatMap(
|
|
76
77
|
Effect.try({
|
|
77
78
|
try: () => new TextEncoder().encode(data),
|
|
78
|
-
catch: () =>
|
|
79
|
-
Error.BadArgument({
|
|
79
|
+
catch: (cause) =>
|
|
80
|
+
new Error.BadArgument({
|
|
80
81
|
module: "FileSystem",
|
|
81
82
|
method: "writeFileString",
|
|
82
|
-
|
|
83
|
+
description: "could not encode string",
|
|
84
|
+
cause
|
|
83
85
|
})
|
|
84
86
|
}),
|
|
85
87
|
(_) => impl.writeFile(path, _, options)
|
|
@@ -88,11 +90,11 @@ export const make = (
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
const notFound = (method: string, path: string) =>
|
|
91
|
-
Error.SystemError({
|
|
93
|
+
new Error.SystemError({
|
|
92
94
|
module: "FileSystem",
|
|
93
95
|
method,
|
|
94
96
|
reason: "NotFound",
|
|
95
|
-
|
|
97
|
+
description: "No such file or directory",
|
|
96
98
|
pathOrDescriptor: path
|
|
97
99
|
})
|
|
98
100
|
|
|
@@ -247,8 +247,8 @@ export const layerSchema = <A, I, R>(
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
/** @internal */
|
|
250
|
-
const storageError = (props: Omit<
|
|
251
|
-
PlatformError.SystemError({
|
|
250
|
+
const storageError = (props: Omit<ConstructorParameters<typeof PlatformError.SystemError>[0], "reason" | "module">) =>
|
|
251
|
+
new PlatformError.SystemError({
|
|
252
252
|
reason: "PermissionDenied",
|
|
253
253
|
module: "KeyValueStore",
|
|
254
254
|
...props
|
|
@@ -266,7 +266,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
|
|
|
266
266
|
storageError({
|
|
267
267
|
pathOrDescriptor: key,
|
|
268
268
|
method: "get",
|
|
269
|
-
|
|
269
|
+
description: `Unable to get item with key ${key}`
|
|
270
270
|
})
|
|
271
271
|
}),
|
|
272
272
|
|
|
@@ -277,7 +277,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
|
|
|
277
277
|
storageError({
|
|
278
278
|
pathOrDescriptor: key,
|
|
279
279
|
method: "set",
|
|
280
|
-
|
|
280
|
+
description: `Unable to set item with key ${key}`
|
|
281
281
|
})
|
|
282
282
|
}),
|
|
283
283
|
|
|
@@ -288,7 +288,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
|
|
|
288
288
|
storageError({
|
|
289
289
|
pathOrDescriptor: key,
|
|
290
290
|
method: "remove",
|
|
291
|
-
|
|
291
|
+
description: `Unable to remove item with key ${key}`
|
|
292
292
|
})
|
|
293
293
|
}),
|
|
294
294
|
|
|
@@ -298,7 +298,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
|
|
|
298
298
|
storageError({
|
|
299
299
|
pathOrDescriptor: "clear",
|
|
300
300
|
method: "clear",
|
|
301
|
-
|
|
301
|
+
description: `Unable to clear storage`
|
|
302
302
|
})
|
|
303
303
|
}),
|
|
304
304
|
|
|
@@ -308,7 +308,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
|
|
|
308
308
|
storageError({
|
|
309
309
|
pathOrDescriptor: "size",
|
|
310
310
|
method: "size",
|
|
311
|
-
|
|
311
|
+
description: `Unable to get size`
|
|
312
312
|
})
|
|
313
313
|
})
|
|
314
314
|
})
|
package/src/internal/path.ts
CHANGED
|
@@ -105,28 +105,34 @@ function _format(sep: string, pathObject: Partial<Api.Path.Parsed>) {
|
|
|
105
105
|
|
|
106
106
|
function fromFileUrl(url: URL): Effect.Effect<string, BadArgument> {
|
|
107
107
|
if (url.protocol !== "file:") {
|
|
108
|
-
return Effect.fail(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
return Effect.fail(
|
|
109
|
+
new BadArgument({
|
|
110
|
+
module: "Path",
|
|
111
|
+
method: "fromFileUrl",
|
|
112
|
+
description: "URL must be of scheme file"
|
|
113
|
+
})
|
|
114
|
+
)
|
|
113
115
|
} else if (url.hostname !== "") {
|
|
114
|
-
return Effect.fail(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
return Effect.fail(
|
|
117
|
+
new BadArgument({
|
|
118
|
+
module: "Path",
|
|
119
|
+
method: "fromFileUrl",
|
|
120
|
+
description: "Invalid file URL host"
|
|
121
|
+
})
|
|
122
|
+
)
|
|
119
123
|
}
|
|
120
124
|
const pathname = url.pathname
|
|
121
125
|
for (let n = 0; n < pathname.length; n++) {
|
|
122
126
|
if (pathname[n] === "%") {
|
|
123
127
|
const third = pathname.codePointAt(n + 2)! | 0x20
|
|
124
128
|
if (pathname[n + 1] === "2" && third === 102) {
|
|
125
|
-
return Effect.fail(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
return Effect.fail(
|
|
130
|
+
new BadArgument({
|
|
131
|
+
module: "Path",
|
|
132
|
+
method: "fromFileUrl",
|
|
133
|
+
description: "must not include encoded / characters"
|
|
134
|
+
})
|
|
135
|
+
)
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.systemError = exports.badArgument = exports.PlatformErrorTypeId = void 0;
|
|
7
|
-
var Data = _interopRequireWildcard(require("effect/Data"));
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
-
/** @internal */
|
|
10
|
-
const PlatformErrorTypeId = exports.PlatformErrorTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Error/PlatformErrorTypeId");
|
|
11
|
-
const make = tag => props => Data.struct({
|
|
12
|
-
[PlatformErrorTypeId]: PlatformErrorTypeId,
|
|
13
|
-
_tag: tag,
|
|
14
|
-
...props
|
|
15
|
-
});
|
|
16
|
-
/** @internal */
|
|
17
|
-
const badArgument = exports.badArgument = /*#__PURE__*/make("BadArgument");
|
|
18
|
-
/** @internal */
|
|
19
|
-
const systemError = exports.systemError = /*#__PURE__*/make("SystemError");
|
|
20
|
-
//# sourceMappingURL=error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":["Data","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PlatformErrorTypeId","exports","Symbol","for","make","tag","props","struct","_tag","badArgument","systemError"],"sources":["../../../src/internal/error.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAGnC;AACO,MAAMkB,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAA8BE,MAAM,CAACC,GAAG,CACtE,4CAA4C,CAChB;AAE9B,MAAMC,IAAI,GACwBC,GAAc,IAAMC,KAAkD,IACpG5B,IAAI,CAAC6B,MAAM,CAAC;EACV,CAACP,mBAAmB,GAAGA,mBAAmB;EAC1CQ,IAAI,EAAEH,GAAG;EACT,GAAGC;CACC,CAAC;AAEX;AACO,MAAMG,WAAW,GAAAR,OAAA,CAAAQ,WAAA,gBAAGL,IAAI,CAAoB,aAAa,CAAC;AAEjE;AACO,MAAMM,WAAW,GAAAT,OAAA,CAAAS,WAAA,gBAAGN,IAAI,CAAoB,aAAa,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/internal/error.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as Data from "effect/Data";
|
|
2
|
-
/** @internal */
|
|
3
|
-
export const PlatformErrorTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Error/PlatformErrorTypeId");
|
|
4
|
-
const make = tag => props => Data.struct({
|
|
5
|
-
[PlatformErrorTypeId]: PlatformErrorTypeId,
|
|
6
|
-
_tag: tag,
|
|
7
|
-
...props
|
|
8
|
-
});
|
|
9
|
-
/** @internal */
|
|
10
|
-
export const badArgument = /*#__PURE__*/make("BadArgument");
|
|
11
|
-
/** @internal */
|
|
12
|
-
export const systemError = /*#__PURE__*/make("SystemError");
|
|
13
|
-
//# sourceMappingURL=error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":["Data","PlatformErrorTypeId","Symbol","for","make","tag","props","struct","_tag","badArgument","systemError"],"sources":["../../../src/internal/error.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,aAAa;AAGnC;AACA,OAAO,MAAMC,mBAAmB,gBAA8BC,MAAM,CAACC,GAAG,CACtE,4CAA4C,CAChB;AAE9B,MAAMC,IAAI,GACwBC,GAAc,IAAMC,KAAkD,IACpGN,IAAI,CAACO,MAAM,CAAC;EACV,CAACN,mBAAmB,GAAGA,mBAAmB;EAC1CO,IAAI,EAAEH,GAAG;EACT,GAAGC;CACC,CAAC;AAEX;AACA,OAAO,MAAMG,WAAW,gBAAGL,IAAI,CAAoB,aAAa,CAAC;AAEjE;AACA,OAAO,MAAMM,WAAW,gBAAGN,IAAI,CAAoB,aAAa,CAAC","ignoreList":[]}
|
package/src/internal/error.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as Data from "effect/Data"
|
|
2
|
-
import type * as Error from "../Error.js"
|
|
3
|
-
|
|
4
|
-
/** @internal */
|
|
5
|
-
export const PlatformErrorTypeId: Error.PlatformErrorTypeId = Symbol.for(
|
|
6
|
-
"@effect/platform/Error/PlatformErrorTypeId"
|
|
7
|
-
) as Error.PlatformErrorTypeId
|
|
8
|
-
|
|
9
|
-
const make =
|
|
10
|
-
<A extends Error.PlatformError>(tag: A["_tag"]) => (props: Omit<A, Error.PlatformError.ProvidedFields>): A =>
|
|
11
|
-
Data.struct({
|
|
12
|
-
[PlatformErrorTypeId]: PlatformErrorTypeId,
|
|
13
|
-
_tag: tag,
|
|
14
|
-
...props
|
|
15
|
-
} as A)
|
|
16
|
-
|
|
17
|
-
/** @internal */
|
|
18
|
-
export const badArgument = make<Error.BadArgument>("BadArgument")
|
|
19
|
-
|
|
20
|
-
/** @internal */
|
|
21
|
-
export const systemError = make<Error.SystemError>("SystemError")
|