MCPcopy Index your code
hub / github.com/simstudioai/sim / parseAtlassianErrorMessage

Function parseAtlassianErrorMessage

apps/sim/tools/jira/utils.ts:222–256  ·  view source on GitHub ↗
(
  status: number,
  statusText: string,
  errorText: string
)

Source from the content-addressed store, hash-verified

220 * field-level errors object, and generic message fallback.
221 */
222export function parseAtlassianErrorMessage(
223 status: number,
224 statusText: string,
225 errorText: string
226): string {
227 try {
228 const errorData = JSON.parse(errorText)
229 if (errorData.errorMessage) {
230 return errorData.errorMessage
231 }
232 if (Array.isArray(errorData.errorMessages) && errorData.errorMessages.length > 0) {
233 return errorData.errorMessages.join(', ')
234 }
235 if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
236 const err = errorData.errors[0]
237 if (err?.title) {
238 return err.detail ? `${err.title}: ${err.detail}` : err.title
239 }
240 }
241 if (errorData.errors && !Array.isArray(errorData.errors)) {
242 const fieldErrors = Object.entries(errorData.errors)
243 .map(([field, msg]) => `${field}: ${msg}`)
244 .join(', ')
245 if (fieldErrors) return fieldErrors
246 }
247 if (errorData.message) {
248 return errorData.message
249 }
250 } catch {
251 if (errorText) {
252 return errorText
253 }
254 }
255 return `${status} ${statusText}`
256}

Callers 15

fetchIssueTypesFunction · 0.90
fetchTransitionsFunction · 0.90
get_transitions.tsFile · 0.90
fetchProjectFunction · 0.90
get_project.tsFile · 0.90
fetchProjectsFunction · 0.90
list_projects.tsFile · 0.90
fetchFieldsFunction · 0.90
get_fields.tsFile · 0.90
route.tsFile · 0.90

Calls 2

parseMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected