main
mapError
function mapError (err: Error, url: string): ApiError { if (err instanceof ApiException) { return { code: err.code, type: err.type,