import { ApiNotFoundError } from "./errors-CQZ-QlOB.js";

//#region src/internal/tool-helpers/enhance-error.ts
/**
* Enhances a 404 error with parameter context to help users understand what went wrong.
* This is optional - tools can use this when they want to provide extra context.
*
* @example
* ```typescript
* try {
*   const issue = await apiService.getIssue({ organizationSlug, issueId });
* } catch (error) {
*   if (error instanceof ApiNotFoundError) {
*     throw enhanceNotFoundError(error, { organizationSlug, issueId });
*   }
*   throw error;
* }
* ```
*/
function enhanceNotFoundError(error, params) {
	const paramsList = [];
	for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null && value !== "") paramsList.push(`${key}: '${value}'`);
	if (paramsList.length > 0) {
		const enhancedMessage = `${error.message}\nPlease verify these parameters are correct:\n${paramsList.map((p) => `  - ${p}`).join("\n")}`;
		return new ApiNotFoundError(enhancedMessage, error.detail, error.responseBody);
	}
	return error;
}

//#endregion
export { enhanceNotFoundError };
//# sourceMappingURL=enhance-error-D3QfZOhm.js.map