@@ -73,8 +73,8 @@ public static LKQLRuntimeException fromMessage(String message) {
73
73
@ CompilerDirectives .TruffleBoundary
74
74
public static LKQLRuntimeException fromJavaException (Throwable e , SourceLocation location ) {
75
75
LKQLRuntimeException res =
76
- new LKQLRuntimeException (
77
- fullErrorText ( "Error from Java bindings: " + e .getMessage (), location ) );
76
+ LKQLRuntimeException . fromMessage (
77
+ "Error from Java bindings: " + e .getMessage (), location );
78
78
res .setStackTrace (e .getStackTrace ());
79
79
return res ;
80
80
}
@@ -89,8 +89,8 @@ public static LKQLRuntimeException fromJavaException(Throwable e, SourceLocation
89
89
@ CompilerDirectives .TruffleBoundary
90
90
public static LKQLRuntimeException fromJavaException (Throwable e , Locatable location ) {
91
91
LKQLRuntimeException res =
92
- new LKQLRuntimeException (
93
- fullErrorText ( "Error from Java bindings: " + e .getMessage (), location ) );
92
+ LKQLRuntimeException . fromMessage (
93
+ "Error from Java bindings: " + e .getMessage (), location );
94
94
res .setStackTrace (e .getStackTrace ());
95
95
return res ;
96
96
}
@@ -103,7 +103,7 @@ public static LKQLRuntimeException fromJavaException(Throwable e, Locatable loca
103
103
*/
104
104
@ CompilerDirectives .TruffleBoundary
105
105
public static LKQLRuntimeException shouldNotExecute (Locatable location ) {
106
- return new LKQLRuntimeException ( fullErrorText ( "Should not execute" , location ) );
106
+ return LKQLRuntimeException . fromMessage ( "Should not execute" , location );
107
107
}
108
108
109
109
/**
@@ -151,8 +151,8 @@ public static LKQLRuntimeException parsingException(
151
151
*/
152
152
@ CompilerDirectives .TruffleBoundary
153
153
public static LKQLRuntimeException regexSyntaxError (String regex , Locatable location ) {
154
- return new LKQLRuntimeException (
155
- fullErrorText ( "Failed to compile regular expression: " + regex , location ) );
154
+ return LKQLRuntimeException . fromMessage (
155
+ "Failed to compile regular expression: " + regex , location );
156
156
}
157
157
158
158
/**
@@ -163,9 +163,8 @@ public static LKQLRuntimeException regexSyntaxError(String regex, Locatable loca
163
163
*/
164
164
@ CompilerDirectives .TruffleBoundary
165
165
public static LKQLRuntimeException ignoredExpressionReturn (Locatable location ) {
166
- return new LKQLRuntimeException (
167
- fullErrorText (
168
- "Can't ignore the return value of an expr in a block expr" , location ));
166
+ return LKQLRuntimeException .fromMessage (
167
+ "Can't ignore the return value of an expr in a block expr" , location );
169
168
}
170
169
171
170
/** Create a new exception when a key appears many times in the same object literal. */
@@ -187,7 +186,7 @@ public static LKQLRuntimeException multipleSameNameKeys(String key, Locatable lo
187
186
*/
188
187
@ CompilerDirectives .TruffleBoundary
189
188
public static LKQLRuntimeException unknownSymbol (String symbol , Locatable location ) {
190
- return new LKQLRuntimeException ( fullErrorText ( "Unknown symbol: " + symbol , location ) );
189
+ return LKQLRuntimeException . fromMessage ( "Unknown symbol: " + symbol , location );
191
190
}
192
191
193
192
/**
@@ -199,8 +198,7 @@ public static LKQLRuntimeException unknownSymbol(String symbol, Locatable locati
199
198
*/
200
199
@ CompilerDirectives .TruffleBoundary
201
200
public static LKQLRuntimeException existingSymbol (String symbol , Locatable location ) {
202
- return new LKQLRuntimeException (
203
- fullErrorText ("Already existing symbol: " + symbol , location ));
201
+ return LKQLRuntimeException .fromMessage ("Already existing symbol: " + symbol , location );
204
202
}
205
203
206
204
/**
@@ -212,8 +210,7 @@ public static LKQLRuntimeException existingSymbol(String symbol, Locatable locat
212
210
*/
213
211
@ CompilerDirectives .TruffleBoundary
214
212
public static LKQLRuntimeException existingParameter (String symbol , Locatable location ) {
215
- return new LKQLRuntimeException (
216
- fullErrorText ("Already existing parameter: " + symbol , location ));
213
+ return LKQLRuntimeException .fromMessage ("Already existing parameter: " + symbol , location );
217
214
}
218
215
219
216
/**
@@ -224,7 +221,7 @@ public static LKQLRuntimeException existingParameter(String symbol, Locatable lo
224
221
*/
225
222
@ CompilerDirectives .TruffleBoundary
226
223
public static LKQLRuntimeException invalidKindName (Locatable location ) {
227
- return new LKQLRuntimeException ( fullErrorText ( "Invalid kind name" , location ) );
224
+ return LKQLRuntimeException . fromMessage ( "Invalid kind name" , location );
228
225
}
229
226
230
227
/**
@@ -236,8 +233,8 @@ public static LKQLRuntimeException invalidKindName(Locatable location) {
236
233
*/
237
234
@ CompilerDirectives .TruffleBoundary
238
235
public static LKQLRuntimeException moduleNotFound (String moduleName , Locatable location ) {
239
- return new LKQLRuntimeException (
240
- fullErrorText ( "Cannot import, module not found \" " + moduleName + "\" " , location ) );
236
+ return LKQLRuntimeException . fromMessage (
237
+ "Cannot import, module not found \" " + moduleName + "\" " , location );
241
238
}
242
239
243
240
// --- Typing exception
@@ -253,8 +250,8 @@ public static LKQLRuntimeException moduleNotFound(String moduleName, Locatable l
253
250
@ CompilerDirectives .TruffleBoundary
254
251
public static LKQLRuntimeException wrongType (
255
252
String expected , String actual , Locatable location ) {
256
- return new LKQLRuntimeException (
257
- fullErrorText ( "Type error: expected " + expected + " but got " + actual , location ) );
253
+ return LKQLRuntimeException . fromMessage (
254
+ "Type error: expected " + expected + " but got " + actual , location );
258
255
}
259
256
260
257
/**
@@ -267,8 +264,8 @@ public static LKQLRuntimeException wrongType(
267
264
*/
268
265
public static LKQLRuntimeException conversionError (
269
266
String source , String target , Locatable location ) {
270
- return new LKQLRuntimeException (
271
- fullErrorText ( "Cannot convert a " + source + " to a " + target , location ) );
267
+ return LKQLRuntimeException . fromMessage (
268
+ "Cannot convert a " + source + " to a " + target , location );
272
269
}
273
270
274
271
/**
@@ -279,8 +276,7 @@ public static LKQLRuntimeException conversionError(
279
276
*/
280
277
@ CompilerDirectives .TruffleBoundary
281
278
public static LKQLRuntimeException wrongFrom (Locatable location ) {
282
- return new LKQLRuntimeException (
283
- fullErrorText ("Wrong kind of element in `from clause`" , location ));
279
+ return LKQLRuntimeException .fromMessage ("Wrong kind of element in `from clause`" , location );
284
280
}
285
281
286
282
/**
@@ -291,35 +287,8 @@ public static LKQLRuntimeException wrongFrom(Locatable location) {
291
287
*/
292
288
@ CompilerDirectives .TruffleBoundary
293
289
public static LKQLRuntimeException wrongFromList (Locatable location ) {
294
- return new LKQLRuntimeException (
295
- fullErrorText ("Wrong kind of element in list for `from clause`" , location ));
296
- }
297
-
298
- /**
299
- * Create an exception from a wrong use of type in a selector.
300
- *
301
- * @param wrongType The used type in the selector.
302
- * @param location The location of the type.
303
- * @return The exception.
304
- */
305
- @ CompilerDirectives .TruffleBoundary
306
- public static LKQLRuntimeException wrongSelectorType (String wrongType , Locatable location ) {
307
- return new LKQLRuntimeException (
308
- fullErrorText (
309
- "Cannot use values of kind " + wrongType + " in a selector" , location ));
310
- }
311
-
312
- /**
313
- * Create an exception for a wrong pattern type.
314
- *
315
- * @param wrongType The wrong pattern type in a string.
316
- * @param location The location of the exception.
317
- * @return The exception.
318
- */
319
- @ CompilerDirectives .TruffleBoundary
320
- public static LKQLRuntimeException wrongPatternType (String wrongType , Locatable location ) {
321
- return new LKQLRuntimeException (
322
- fullErrorText ("Invalid pattern kind: " + wrongType , location ));
290
+ return LKQLRuntimeException .fromMessage (
291
+ "Wrong kind of element in list for `from clause`" , location );
323
292
}
324
293
325
294
/**
@@ -331,9 +300,8 @@ public static LKQLRuntimeException wrongPatternType(String wrongType, Locatable
331
300
*/
332
301
@ CompilerDirectives .TruffleBoundary
333
302
public static LKQLRuntimeException unsupportedType (String type , Locatable location ) {
334
- return new LKQLRuntimeException (
335
- fullErrorText (
336
- "Unsupported value type from the introspection API: " + type , location ));
303
+ return LKQLRuntimeException .fromMessage (
304
+ "Unsupported value type from the introspection API: " + type , location );
337
305
}
338
306
339
307
// --- Operator exception
@@ -350,10 +318,8 @@ public static LKQLRuntimeException unsupportedType(String type, Locatable locati
350
318
@ CompilerDirectives .TruffleBoundary
351
319
public static LKQLRuntimeException unsupportedOperation (
352
320
String leftType , String op , String rightType , Locatable location ) {
353
- return new LKQLRuntimeException (
354
- fullErrorText (
355
- "Unsupported operation: " + leftType + " " + op + " " + rightType ,
356
- location ));
321
+ return LKQLRuntimeException .fromMessage (
322
+ "Unsupported operation: " + leftType + " " + op + " " + rightType , location );
357
323
}
358
324
359
325
/**
@@ -364,7 +330,7 @@ public static LKQLRuntimeException unsupportedOperation(
364
330
*/
365
331
@ CompilerDirectives .TruffleBoundary
366
332
public static LKQLRuntimeException divByZero (Locatable location ) {
367
- return new LKQLRuntimeException ( fullErrorText ( "Zero division" , location ) );
333
+ return LKQLRuntimeException . fromMessage ( "Zero division" , location );
368
334
}
369
335
370
336
/**
@@ -376,7 +342,7 @@ public static LKQLRuntimeException divByZero(Locatable location) {
376
342
*/
377
343
@ CompilerDirectives .TruffleBoundary
378
344
public static LKQLRuntimeException invalidIndex (int index , Locatable location ) {
379
- return new LKQLRuntimeException ( fullErrorText ( "Invalid index: " + index , location ) );
345
+ return LKQLRuntimeException . fromMessage ( "Invalid index: " + index , location );
380
346
}
381
347
382
348
/**
@@ -387,7 +353,7 @@ public static LKQLRuntimeException invalidIndex(int index, Locatable location) {
387
353
*/
388
354
@ CompilerDirectives .TruffleBoundary
389
355
public static LKQLRuntimeException noSuchMember (Locatable location ) {
390
- return new LKQLRuntimeException ( fullErrorText ( "No such member" , location ) );
356
+ return LKQLRuntimeException . fromMessage ( "No such member" , location );
391
357
}
392
358
393
359
/**
@@ -398,7 +364,7 @@ public static LKQLRuntimeException noSuchMember(Locatable location) {
398
364
*/
399
365
@ CompilerDirectives .TruffleBoundary
400
366
public static LKQLRuntimeException noSuchField (Locatable location ) {
401
- return new LKQLRuntimeException ( fullErrorText ( "No such field" , location ) );
367
+ return LKQLRuntimeException . fromMessage ( "No such field" , location );
402
368
}
403
369
404
370
/**
@@ -411,8 +377,8 @@ public static LKQLRuntimeException noSuchField(Locatable location) {
411
377
*/
412
378
@ CompilerDirectives .TruffleBoundary
413
379
public static LKQLRuntimeException wrongMember (String member , String type , Locatable location ) {
414
- return new LKQLRuntimeException (
415
- fullErrorText ( "Cannot get member " + member + " for " + type + " value" , location ) );
380
+ return LKQLRuntimeException . fromMessage (
381
+ "Cannot get member " + member + " for " + type + " value" , location );
416
382
}
417
383
418
384
/**
@@ -423,7 +389,7 @@ public static LKQLRuntimeException wrongMember(String member, String type, Locat
423
389
*/
424
390
@ CompilerDirectives .TruffleBoundary
425
391
public static LKQLRuntimeException nullReceiver (Locatable location ) {
426
- return new LKQLRuntimeException ( fullErrorText ( "Null receiver in dot access" , location ) );
392
+ return LKQLRuntimeException . fromMessage ( "Null receiver in dot access" , location );
427
393
}
428
394
429
395
// --- Argument exception
@@ -438,8 +404,8 @@ public static LKQLRuntimeException nullReceiver(Locatable location) {
438
404
*/
439
405
@ CompilerDirectives .TruffleBoundary
440
406
public static LKQLRuntimeException wrongArity (int expected , int actual , Locatable location ) {
441
- return new LKQLRuntimeException (
442
- fullErrorText ( "Expected " + expected + " arguments but got " + actual , location ) );
407
+ return LKQLRuntimeException . fromMessage (
408
+ "Expected " + expected + " arguments but got " + actual , location );
443
409
}
444
410
445
411
/**
@@ -451,8 +417,7 @@ public static LKQLRuntimeException wrongArity(int expected, int actual, Locatabl
451
417
*/
452
418
@ CompilerDirectives .TruffleBoundary
453
419
public static LKQLRuntimeException unknownArgument (String unknown , Locatable location ) {
454
- return new LKQLRuntimeException (
455
- fullErrorText ("Unknown argument name: " + unknown , location ));
420
+ return LKQLRuntimeException .fromMessage ("Unknown argument name: " + unknown , location );
456
421
}
457
422
458
423
/**
@@ -464,8 +429,8 @@ public static LKQLRuntimeException unknownArgument(String unknown, Locatable loc
464
429
*/
465
430
@ CompilerDirectives .TruffleBoundary
466
431
public static LKQLRuntimeException missingArgument (int missingIndex , Locatable location ) {
467
- return new LKQLRuntimeException (
468
- fullErrorText ( "Missing value for param # " + missingIndex + " in call" , location ) );
432
+ return LKQLRuntimeException . fromMessage (
433
+ "Missing value for param # " + missingIndex + " in call" , location );
469
434
}
470
435
471
436
/**
@@ -476,8 +441,8 @@ public static LKQLRuntimeException missingArgument(int missingIndex, Locatable l
476
441
*/
477
442
@ CompilerDirectives .TruffleBoundary
478
443
public static LKQLRuntimeException selectorWithoutNode (Locatable location ) {
479
- return new LKQLRuntimeException (
480
- fullErrorText ( "Selector call should have a node argument" , location ) );
444
+ return LKQLRuntimeException . fromMessage (
445
+ "Selector call should have a node argument" , location );
481
446
}
482
447
483
448
/**
@@ -488,8 +453,7 @@ public static LKQLRuntimeException selectorWithoutNode(Locatable location) {
488
453
*/
489
454
@ CompilerDirectives .TruffleBoundary
490
455
public static LKQLRuntimeException multipleSameNameArgument (Locatable location ) {
491
- return new LKQLRuntimeException (
492
- fullErrorText ("Multiple arguments with the same name" , location ));
456
+ return LKQLRuntimeException .fromMessage ("Multiple arguments with the same name" , location );
493
457
}
494
458
495
459
/**
@@ -500,8 +464,8 @@ public static LKQLRuntimeException multipleSameNameArgument(Locatable location)
500
464
*/
501
465
@ CompilerDirectives .TruffleBoundary
502
466
public static LKQLRuntimeException positionAfterNamedArgument (Locatable location ) {
503
- return new LKQLRuntimeException (
504
- fullErrorText ( "positional argument after named argument" , location ) );
467
+ return LKQLRuntimeException . fromMessage (
468
+ "positional argument after named argument" , location );
505
469
}
506
470
507
471
// ----- Class methods -----
0 commit comments