ReactOS 0.4.16-dev-297-gc569aee
error.c File Reference
#include <math.h>
#include "jscript.h"
#include "wine/debug.h"
Include dependency graph for error.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (jscript)
 
static HRESULT Error_toString (script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT Error_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT alloc_error (script_ctx_t *ctx, jsdisp_t *prototype, jsdisp_t *constr, jsdisp_t **ret)
 
static HRESULT create_error (script_ctx_t *ctx, jsdisp_t *constr, UINT number, jsstr_t *msg, jsdisp_t **ret)
 
static HRESULT error_constr (script_ctx_t *ctx, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, jsdisp_t *constr)
 
static HRESULT ErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT EvalErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT RangeErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT ReferenceErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT RegExpErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT SyntaxErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT TypeErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
static HRESULT URIErrorConstr_value (script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
 
HRESULT init_error_constr (script_ctx_t *ctx, jsdisp_t *object_prototype)
 
static HRESULT throw_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str, jsdisp_t *constr)
 
HRESULT throw_generic_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_range_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_reference_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_regexp_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_syntax_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_type_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 
HRESULT throw_uri_error (script_ctx_t *ctx, HRESULT error, const WCHAR *str)
 

Variables

static const WCHAR descriptionW [] = {'d','e','s','c','r','i','p','t','i','o','n',0}
 
static const WCHAR messageW [] = {'m','e','s','s','a','g','e',0}
 
static const WCHAR nameW [] = {'n','a','m','e',0}
 
static const WCHAR numberW [] = {'n','u','m','b','e','r',0}
 
static const WCHAR toStringW [] = {'t','o','S','t','r','i','n','g',0}
 
static const builtin_prop_t Error_props []
 
static const builtin_info_t Error_info
 
static const builtin_info_t ErrorInst_info
 

Function Documentation

◆ alloc_error()

static HRESULT alloc_error ( script_ctx_t ctx,
jsdisp_t prototype,
jsdisp_t constr,
jsdisp_t **  ret 
)
static

Definition at line 164 of file error.c.

166{
167 jsdisp_t *err;
169
170 err = heap_alloc_zero(sizeof(*err));
171 if(!err)
172 return E_OUTOFMEMORY;
173
174 if(prototype)
175 hres = init_dispex(err, ctx, &Error_info, prototype);
176 else
178 constr ? constr : ctx->error_constr);
179 if(FAILED(hres)) {
180 heap_free(err);
181 return hres;
182 }
183
184 *ret = err;
185 return S_OK;
186}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const builtin_info_t Error_info
Definition: error.c:146
static const builtin_info_t ErrorInst_info
Definition: error.c:155
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
HRESULT hres
Definition: protocol.c:465
#define err(...)
int ret

Referenced by create_error(), and init_error_constr().

◆ create_error()

static HRESULT create_error ( script_ctx_t ctx,
jsdisp_t constr,
UINT  number,
jsstr_t msg,
jsdisp_t **  ret 
)
static

Definition at line 188 of file error.c.

190{
191 jsdisp_t *err;
193
194 hres = alloc_error(ctx, NULL, constr, &err);
195 if(FAILED(hres))
196 return hres;
197
200 if(FAILED(hres)) {
202 return hres;
203 }
204
208 if(SUCCEEDED(hres))
211 if(FAILED(hres)) {
213 return hres;
214 }
215
216 *ret = err;
217 return S_OK;
218}
#define msg(x)
Definition: auth_time.c:54
#define NULL
Definition: types.h:112
static const WCHAR messageW[]
Definition: error.c:33
static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype, jsdisp_t *constr, jsdisp_t **ret)
Definition: error.c:164
static const WCHAR numberW[]
Definition: error.c:35
static const WCHAR descriptionW[]
Definition: error.c:32
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
#define PROPF_WRITABLE
Definition: jscript.h:101
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
#define PROPF_CONFIGURABLE
Definition: jscript.h:102
#define PROPF_ENUMERABLE
Definition: jscript.h:100
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
static jsval_t jsval_number(double n)
Definition: jsval.h:144
static unsigned int number
Definition: dsound.c:1479
int32_t INT
Definition: typedefs.h:58

Referenced by error_constr(), test_file_access(), and throw_error().

◆ error_constr()

static HRESULT error_constr ( script_ctx_t ctx,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r,
jsdisp_t constr 
)
static

Definition at line 220 of file error.c.

221 {
222 jsdisp_t *err;
223 UINT num = 0;
224 jsstr_t *msg = NULL;
226
227 if(argc) {
228 double n;
229
230 hres = to_number(ctx, argv[0], &n);
231 if(FAILED(hres)) /* FIXME: really? */
232 n = NAN;
233 if(isnan(n))
234 hres = to_string(ctx, argv[0], &msg);
235 if(FAILED(hres))
236 return hres;
237 num = n;
238 }
239
240 if(!msg) {
241 if(argc > 1) {
242 hres = to_string(ctx, argv[1], &msg);
243 if(FAILED(hres))
244 return hres;
245 }else {
246 msg = jsstr_empty();
247 }
248 }
249
250 switch(flags) {
251 case INVOKE_FUNC:
252 case DISPATCH_CONSTRUCT:
253 hres = create_error(ctx, constr, num, msg, &err);
255 if(FAILED(hres))
256 return hres;
257
258 if(r)
259 *r = jsval_obj(err);
260 else
262 return S_OK;
263
264 default:
265 if(msg)
267 FIXME("unimplemented flags %x\n", flags);
268 return E_NOTIMPL;
269 }
270}
static int argc
Definition: ServiceArgs.c:12
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT create_error(script_ctx_t *ctx, jsdisp_t *constr, UINT number, jsstr_t *msg, jsdisp_t **ret)
Definition: error.c:188
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLbitfield flags
Definition: glext.h:7161
GLuint GLuint num
Definition: glext.h:9618
static HRESULT to_string(VARIANT *src, BSTR *dst)
Definition: host.c:47
HRESULT to_number(script_ctx_t *, jsval_t, double *) DECLSPEC_HIDDEN
Definition: jsutils.c:609
jsstr_t * jsstr_empty(void)
Definition: jsstr.c:288
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
#define isnan(x)
Definition: mingw_math.h:133
#define NAN
Definition: mesh.c:39
#define argv
Definition: mplay32.c:18
unsigned int UINT
Definition: ndis.h:50
Definition: jsstr.h:39

Referenced by ErrorConstr_value(), EvalErrorConstr_value(), RangeErrorConstr_value(), ReferenceErrorConstr_value(), RegExpErrorConstr_value(), SyntaxErrorConstr_value(), TypeErrorConstr_value(), and URIErrorConstr_value().

◆ Error_toString()

static HRESULT Error_toString ( script_ctx_t ctx,
vdisp_t vthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 39 of file error.c.

41{
42 jsdisp_t *jsthis;
43 jsstr_t *name = NULL, *msg = NULL, *ret = NULL;
44 jsval_t v;
46
47 static const WCHAR object_errorW[] = {'[','o','b','j','e','c','t',' ','E','r','r','o','r',']',0};
48
49 TRACE("\n");
50
51 jsthis = get_jsdisp(vthis);
52 if(!jsthis || ctx->version < 2) {
53 if(r) {
54 jsstr_t *str;
55
56 str = jsstr_alloc(object_errorW);
57 if(!str)
58 return E_OUTOFMEMORY;
59 *r = jsval_string(str);
60 }
61 return S_OK;
62 }
63
64 hres = jsdisp_propget_name(jsthis, nameW, &v);
65 if(FAILED(hres))
66 return hres;
67
68 if(!is_undefined(v)) {
69 hres = to_string(ctx, v, &name);
71 if(FAILED(hres))
72 return hres;
73 }
74
76 if(SUCCEEDED(hres)) {
77 if(!is_undefined(v)) {
78 hres = to_string(ctx, v, &msg);
80 }
81 }
82
83 if(SUCCEEDED(hres)) {
84 unsigned name_len = name ? jsstr_length(name) : 0;
85 unsigned msg_len = msg ? jsstr_length(msg) : 0;
86
87 if(name_len && msg_len) {
88 WCHAR *ptr;
89
90 ret = jsstr_alloc_buf(name_len + msg_len + 2, &ptr);
91 if(ret) {
93 ptr[name_len] = ':';
94 ptr[name_len+1] = ' ';
95 jsstr_flush(msg, ptr+name_len+2);
96 }else {
98 }
99 }else if(name_len) {
100 ret = name;
101 name = NULL;
102 }else if(msg_len) {
103 ret = msg;
104 msg = NULL;
105 }else {
106 ret = jsstr_alloc(object_errorW);
107 }
108 }
109
110 if(msg)
112 if(name)
114 if(FAILED(hres))
115 return hres;
116 if(!ret)
117 return E_OUTOFMEMORY;
118
119 if(r)
120 *r = jsval_string(ret);
121 else
123 return S_OK;
124}
static const WCHAR nameW[]
Definition: error.c:34
const GLdouble * v
Definition: gl.h:2040
HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
Definition: dispex.c:1408
static jsdisp_t * get_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:199
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
void jsval_release(jsval_t val)
Definition: jsutils.c:191
static BOOL is_undefined(jsval_t v)
Definition: jsval.h:171
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
Definition: jsval.h:54
Definition: name.c:39
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ Error_value()

static HRESULT Error_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 126 of file error.c.

128{
129 TRACE("\n");
130
131 switch(flags) {
132 case INVOKE_FUNC:
134 default:
135 FIXME("unimplemented flags %x\n", flags);
136 return E_NOTIMPL;
137 }
138
139 return S_OK;
140}
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
#define JS_E_FUNCTION_EXPECTED
Definition: jscript.h:552

◆ ErrorConstr_value()

static HRESULT ErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 272 of file error.c.

274{
275 TRACE("\n");
276 return error_constr(ctx, flags, argc, argv, r, ctx->error_constr);
277}
static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r, jsdisp_t *constr)
Definition: error.c:220

Referenced by init_error_constr().

◆ EvalErrorConstr_value()

static HRESULT EvalErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 279 of file error.c.

281{
282 TRACE("\n");
283 return error_constr(ctx, flags, argc, argv, r, ctx->eval_error_constr);
284}

Referenced by init_error_constr().

◆ init_error_constr()

HRESULT init_error_constr ( script_ctx_t ctx,
jsdisp_t object_prototype 
)

Definition at line 328 of file error.c.

329{
330 static const WCHAR ErrorW[] = {'E','r','r','o','r',0};
331 static const WCHAR EvalErrorW[] = {'E','v','a','l','E','r','r','o','r',0};
332 static const WCHAR RangeErrorW[] = {'R','a','n','g','e','E','r','r','o','r',0};
333 static const WCHAR ReferenceErrorW[] = {'R','e','f','e','r','e','n','c','e','E','r','r','o','r',0};
334 static const WCHAR RegExpErrorW[] = {'R','e','g','E','x','p','E','r','r','o','r',0};
335 static const WCHAR SyntaxErrorW[] = {'S','y','n','t','a','x','E','r','r','o','r',0};
336 static const WCHAR TypeErrorW[] = {'T','y','p','e','E','r','r','o','r',0};
337 static const WCHAR URIErrorW[] = {'U','R','I','E','r','r','o','r',0};
338 static const WCHAR *names[] = {ErrorW, EvalErrorW, RangeErrorW,
340 jsdisp_t **constr_addr[] = {&ctx->error_constr, &ctx->eval_error_constr,
341 &ctx->range_error_constr, &ctx->reference_error_constr, &ctx->regexp_error_constr,
342 &ctx->syntax_error_constr, &ctx->type_error_constr,
343 &ctx->uri_error_constr};
347
348 jsdisp_t *err;
349 unsigned int i;
350 jsstr_t *str;
352
353 for(i=0; i < ARRAY_SIZE(names); i++) {
354 hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err);
355 if(FAILED(hres))
356 return hres;
357
359 if(!str) {
361 return E_OUTOFMEMORY;
362 }
363
367 if(SUCCEEDED(hres))
368 hres = create_builtin_constructor(ctx, constr_val[i], names[i], NULL,
369 PROPF_CONSTR|1, err, constr_addr[i]);
370
372 if(FAILED(hres))
373 return hres;
374 }
375
376 return S_OK;
377}
#define ARRAY_SIZE(A)
Definition: main.h:20
static HRESULT SyntaxErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:307
static HRESULT ReferenceErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:293
static HRESULT URIErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:321
static HRESULT RangeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:286
static HRESULT RegExpErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:300
static HRESULT EvalErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:279
static HRESULT TypeErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:314
static HRESULT ErrorConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:272
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
GLuint GLuint * names
Definition: glext.h:11545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR RangeErrorW[]
Definition: global.c:41
static const WCHAR RegExpErrorW[]
Definition: global.c:51
static const WCHAR SyntaxErrorW[]
Definition: global.c:43
static const WCHAR URIErrorW[]
Definition: global.c:45
static const WCHAR ReferenceErrorW[]
Definition: global.c:42
static const WCHAR EvalErrorW[]
Definition: global.c:40
static const WCHAR ErrorW[]
Definition: global.c:39
static const WCHAR TypeErrorW[]
Definition: global.c:44
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT(* builtin_invoke_t)(script_ctx_t *, vdisp_t *, WORD, unsigned, jsval_t *, jsval_t *)
Definition: jscript.h:204

Referenced by init_constructors().

◆ RangeErrorConstr_value()

static HRESULT RangeErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 286 of file error.c.

288{
289 TRACE("\n");
290 return error_constr(ctx, flags, argc, argv, r, ctx->range_error_constr);
291}

Referenced by init_error_constr().

◆ ReferenceErrorConstr_value()

static HRESULT ReferenceErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 293 of file error.c.

295{
296 TRACE("\n");
297 return error_constr(ctx, flags, argc, argv, r, ctx->reference_error_constr);
298}

Referenced by init_error_constr().

◆ RegExpErrorConstr_value()

static HRESULT RegExpErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 300 of file error.c.

302{
303 TRACE("\n");
304 return error_constr(ctx, flags, argc, argv, r, ctx->regexp_error_constr);
305}

Referenced by init_error_constr().

◆ SyntaxErrorConstr_value()

static HRESULT SyntaxErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 307 of file error.c.

309{
310 TRACE("\n");
311 return error_constr(ctx, flags, argc, argv, r, ctx->syntax_error_constr);
312}

Referenced by init_error_constr().

◆ throw_error()

static HRESULT throw_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str,
jsdisp_t constr 
)
static

Definition at line 379 of file error.c.

380{
381 WCHAR buf[1024], *pos = NULL;
382 jsdisp_t *err;
383 jsstr_t *msg;
385
387 return error;
388
389 buf[0] = '\0';
391
392 if(str) pos = wcschr(buf, '|');
393 if(pos) {
394 int len = lstrlenW(str);
395 memmove(pos+len, pos+1, (lstrlenW(pos+1)+1)*sizeof(WCHAR));
396 memcpy(pos, str, len*sizeof(WCHAR));
397 }
398
399 WARN("%s\n", debugstr_w(buf));
400
402 if(!msg)
403 return E_OUTOFMEMORY;
404
405 hres = create_error(ctx, constr, error, msg, &err);
407 if(FAILED(hres))
408 return hres;
409
410 jsval_release(ctx->ei.val);
411 ctx->ei.val = jsval_obj(err);
412 return error;
413}
#define WARN(fmt,...)
Definition: precomp.h:61
#define wcschr
Definition: compat.h:17
#define lstrlenW
Definition: compat.h:750
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
static BOOL is_jscript_error(HRESULT hres)
Definition: jscript.h:575
HINSTANCE jscript_hinstance
Definition: jscript_main.c:39
#define debugstr_w
Definition: kernel32.h:32
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define HRESULT_CODE(hr)
Definition: winerror.h:76
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

Referenced by throw_generic_error(), throw_range_error(), throw_reference_error(), throw_regexp_error(), throw_syntax_error(), throw_type_error(), and throw_uri_error().

◆ throw_generic_error()

HRESULT throw_generic_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 415 of file error.c.

416{
417 return throw_error(ctx, error, str, ctx->error_constr);
418}
static HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str, jsdisp_t *constr)
Definition: error.c:379

Referenced by ActiveXObject_value().

◆ throw_range_error()

HRESULT throw_range_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

◆ throw_reference_error()

HRESULT throw_reference_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 425 of file error.c.

426{
427 return throw_error(ctx, error, str, ctx->reference_error_constr);
428}

Referenced by interp_assign(), interp_assign_call(), interp_refval(), and interp_throw_ref().

◆ throw_regexp_error()

HRESULT throw_regexp_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 430 of file error.c.

431{
432 return throw_error(ctx, error, str, ctx->regexp_error_constr);
433}

Referenced by RegExpConstr_value().

◆ throw_syntax_error()

HRESULT throw_syntax_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 435 of file error.c.

436{
437 return throw_error(ctx, error, str, ctx->syntax_error_constr);
438}

Referenced by EnumeratorConstr_value(), and JSGlobal_eval().

◆ throw_type_error()

HRESULT throw_type_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 440 of file error.c.

441{
442 return throw_error(ctx, error, str, ctx->type_error_constr);
443}

Referenced by Array_toString(), Bool_toString(), Bool_value(), Bool_valueOf(), create_utc_string(), Date_getDate(), Date_getDay(), Date_getFullYear(), Date_getHours(), Date_getMilliseconds(), Date_getMinutes(), Date_getMonth(), Date_getSeconds(), Date_getTime(), Date_getTimezoneOffset(), Date_getUTCDate(), Date_getUTCDay(), Date_getUTCFullYear(), Date_getUTCHours(), Date_getUTCMilliseconds(), Date_getUTCMinutes(), Date_getUTCMonth(), Date_getUTCSeconds(), Date_getYear(), Date_setDate(), Date_setFullYear(), Date_setHours(), Date_setMilliseconds(), Date_setMinutes(), Date_setMonth(), Date_setSeconds(), Date_setTime(), Date_setUTCDate(), Date_setUTCFullYear(), Date_setUTCHours(), Date_setUTCMilliseconds(), Date_setUTCMinutes(), Date_setUTCMonth(), Date_setUTCSeconds(), Date_setYear(), Date_toDateString(), Date_toISOString(), Date_toLocaleDateString(), Date_toLocaleString(), Date_toLocaleTimeString(), Date_toString(), Date_toTimeString(), Date_valueOf(), Enumerator_atEnd(), Enumerator_item(), Enumerator_moveFirst(), Enumerator_moveNext(), Error_value(), Function_apply(), Function_bind(), Function_call(), Function_toString(), get_length(), identifier_value(), interp_call(), interp_call_member(), interp_in(), interp_instanceof(), interp_new(), interp_postinc(), interp_preinc(), interp_throw_type(), jsdisp_call_value(), jsdisp_define_property(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), Number_valueOf(), Object_defineProperty(), Object_getOwnPropertyDescriptor(), RegExp_value(), stack_pop_object(), to_object(), to_primitive(), to_property_descriptor(), VBArray_dimensions(), VBArray_getItem(), VBArray_lbound(), VBArray_toArray(), VBArray_ubound(), and VBArrayConstr_value().

◆ throw_uri_error()

HRESULT throw_uri_error ( script_ctx_t ctx,
HRESULT  error,
const WCHAR str 
)

Definition at line 445 of file error.c.

446{
447 return throw_error(ctx, error, str, ctx->uri_error_constr);
448}

Referenced by JSGlobal_decodeURI(), JSGlobal_encodeURI(), and JSGlobal_encodeURIComponent().

◆ TypeErrorConstr_value()

static HRESULT TypeErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 314 of file error.c.

316{
317 TRACE("\n");
318 return error_constr(ctx, flags, argc, argv, r, ctx->type_error_constr);
319}

Referenced by init_error_constr().

◆ URIErrorConstr_value()

static HRESULT URIErrorConstr_value ( script_ctx_t ctx,
vdisp_t jsthis,
WORD  flags,
unsigned  argc,
jsval_t argv,
jsval_t r 
)
static

Definition at line 321 of file error.c.

323{
324 TRACE("\n");
325 return error_constr(ctx, flags, argc, argv, r, ctx->uri_error_constr);
326}

Referenced by init_error_constr().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( jscript  )

Variable Documentation

◆ descriptionW

const WCHAR descriptionW[] = {'d','e','s','c','r','i','p','t','i','o','n',0}
static

◆ Error_info

const builtin_info_t Error_info
static
Initial value:
= {
}
static HRESULT Error_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:126
static const builtin_prop_t Error_props[]
Definition: error.c:142
@ JSCLASS_ERROR
Definition: jscript.h:125

Definition at line 146 of file error.c.

Referenced by alloc_error().

◆ Error_props

const builtin_prop_t Error_props[]
static
Initial value:
= {
}
static const WCHAR toStringW[]
Definition: error.c:36
static HRESULT Error_toString(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: error.c:39
#define PROPF_METHOD
Definition: jscript.h:97

Definition at line 142 of file error.c.

◆ ErrorInst_info

const builtin_info_t ErrorInst_info
static
Initial value:

Definition at line 155 of file error.c.

Referenced by alloc_error().

◆ messageW

const WCHAR messageW[] = {'m','e','s','s','a','g','e',0}
static

Definition at line 33 of file error.c.

Referenced by create_error(), Error_toString(), MAPISendMail(), OpenMailer(), and unwind_exception().

◆ nameW

const WCHAR nameW[] = {'n','a','m','e',0}
static

Definition at line 34 of file error.c.

Referenced by Error_toString(), and init_error_constr().

◆ numberW

const WCHAR numberW[] = {'n','u','m','b','e','r',0}
static

Definition at line 35 of file error.c.

Referenced by create_error().

◆ toStringW

const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}
static

Definition at line 36 of file error.c.