MCPcopy Create free account
hub / github.com/Effect-TS/effect / message

Method message

packages/effect/src/unstable/ai/AiError.ts:137–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135 }
136
137 override get message(): string {
138 const methodAndUrl = `${this.request.method} ${this.request.url}`
139
140 let baseMessage = this.description
141 ? `${this.reason}: ${this.description}`
142 : `${this.reason}: A network error occurred.`
143
144 baseMessage += ` (${methodAndUrl})`
145
146 let suggestion = ""
147 switch (this.reason) {
148 case "EncodeError": {
149 suggestion += "Check that the request body data is properly formatted and matches the expected content type."
150 break
151 }
152
153 case "InvalidUrlError": {
154 suggestion += "Verify that the URL format is correct and that all required parameters have been provided."
155 suggestion += " Check for any special characters that may need encoding."
156 break
157 }
158
159 case "TransportError": {
160 suggestion += "Check your network connection and verify that the requested URL is accessible."
161 break
162 }
163 }
164
165 baseMessage += `\n\n${suggestion}`
166
167 return baseMessage
168 }
169}
170
171// =============================================================================

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected