ErrorMessages.h (1581B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* 8 * SpiderMonkey internal error numbering and error-formatting functionality 9 * (also for warnings). 10 * 11 * This functionality is moderately stable. JSErrNum and js::GetErrorMessage 12 * are widely used inside SpiderMonkey, and Gecko uses them to produce errors 13 * identical to those SpiderMonkey itself would produce, in various situations. 14 * However, the set of error numbers is not stable, error number values are not 15 * stable, error types are not stable, etc. Use your own error reporting code 16 * if you can. 17 */ 18 19 #ifndef js_friend_ErrorMessages_h 20 #define js_friend_ErrorMessages_h 21 22 #include "jstypes.h" // JS_PUBLIC_API 23 24 struct JSErrorFormatString; 25 26 enum JSErrNum { 27 #define MSG_DEF(name, count, exception, format) name, 28 #include "js/friend/ErrorNumbers.msg" 29 #undef MSG_DEF 30 JSErr_Limit 31 }; 32 33 namespace js { 34 35 /** 36 * A JSErrorCallback suitable for passing to |JS_ReportErrorNumberASCII| and 37 * similar functions in concert with one of the |JSErrNum| error numbers. 38 * 39 * This function is a function only of |errorNumber|: |userRef| and ambient 40 * state have no effect on its behavior. 41 */ 42 extern JS_PUBLIC_API const JSErrorFormatString* GetErrorMessage( 43 void* userRef, unsigned errorNumber); 44 45 } // namespace js 46 47 #endif // js_friend_ErrorMessages_h