MCPcopy Create free account
hub / github.com/anomalyco/opencode / accountErrorFromCause

Function accountErrorFromCause

packages/opencode/src/account/account.ts:149–166  ·  view source on GitHub ↗
(cause: unknown, message: string)

Source from the content-addressed store, hash-verified

147 effect.pipe(Effect.mapError((cause) => accountErrorFromCause(cause, message)))
148
149const accountErrorFromCause = (cause: unknown, message: string): AccountError => {
150 if (cause instanceof AccountServiceError || cause instanceof AccountTransportError) {
151 return cause
152 }
153
154 if (HttpClientError.isHttpClientError(cause)) {
155 switch (cause.reason._tag) {
156 case "TransportError": {
157 return AccountTransportError.fromHttpClientError(cause.reason)
158 }
159 default: {
160 return new AccountServiceError({ message, cause })
161 }
162 }
163 }
164
165 return new AccountServiceError({ message, cause })
166}
167
168export interface Interface {
169 readonly active: () => Effect.Effect<Option.Option<Info>, AccountError>

Callers 1

mapAccountServiceErrorFunction · 0.85

Calls 1

fromHttpClientErrorMethod · 0.45

Tested by

no test coverage detected