/**
 * Transforms an unknown error to an error message string.
 */
export function unknownToErrorMessage(error: unknown, message: string): string {
  return `${message}: ${error instanceof Error ? error.message : JSON.stringify(error)}`
}

/**
 * Makes sure that the URL always ends with a slash.
 */
export const normalizeUrl = (url: string): string => {
  return url.endsWith('/') ? url : `${url}/`
}
