Rocky_Mountain_Vending/.pnpm-store/v10/files/bd/38091e3a422615852c083a029e08f3896b489d9b5f21b5e39f8c2edee8afd2754663d8c7bda937f6f16474470fc98cda209ca8e4f08296de71311513864e48
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

74 lines
No EOL
2.2 KiB
Text

/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* function to execute patched function and being able to catch errors
* @param execute - function to be executed
* @param onFinish - callback to run when execute finishes
*/
export function safeExecuteInTheMiddle(execute, onFinish, preventThrowingError) {
let error;
let result;
try {
result = execute();
}
catch (e) {
error = e;
}
finally {
onFinish(error, result);
if (error && !preventThrowingError) {
// eslint-disable-next-line no-unsafe-finally
throw error;
}
// eslint-disable-next-line no-unsafe-finally
return result;
}
}
/**
* Async function to execute patched function and being able to catch errors
* @param execute - function to be executed
* @param onFinish - callback to run when execute finishes
*/
export async function safeExecuteInTheMiddleAsync(execute, onFinish, preventThrowingError) {
let error;
let result;
try {
result = await execute();
}
catch (e) {
error = e;
}
finally {
onFinish(error, result);
if (error && !preventThrowingError) {
// eslint-disable-next-line no-unsafe-finally
throw error;
}
// eslint-disable-next-line no-unsafe-finally
return result;
}
}
/**
* Checks if certain function has been already wrapped
* @param func
*/
export function isWrapped(func) {
return (typeof func === 'function' &&
typeof func.__original === 'function' &&
typeof func.__unwrap === 'function' &&
func.__wrapped === true);
}
//# sourceMappingURL=utils.js.map