Wrong error message on Map<String>
Hi Scott,
I have here obviously wrong apex method, despite that the IDE won’t give me any error message until I attempt to deploy it, which gives me unexpected error.
public with sharing class Test {
@AuraEnabled
public static void test(Map<String> strings) {
System.debug(strings);
}
}
returns An unexpected error occurred. Please include this ErrorId if you contact support: 2129936922-2909 (-1163967515)
Removing the @AuraEnabled
decorator then gives proper error messages
Invalid type argument count for Map: expected 2 but found 1
and Method does not exist or incorrect signature: void debug(Map) from the type System
Is this something what you can fix? Also it would be handy if IDE would be able to tell without deployment that something is not right, like when you tries to access a field which is not in OST or something like that.
Comments (4)
-
repo owner -
repo owner Enhancement for type parameter count validation committed for the next build.
-
repo owner - changed status to open
-
repo owner - changed status to resolved
Delivered in 2.2.8.2.
- Log in to comment
Hi. The error you’re getting back is an internal server error, also known as a GACK:
https://developer.salesforce.com/blogs/engineering/2015/02/gack
Unfortunately there’s no way for IC2 to know when some API call against the server will result in a GACK because technically they shouldn’t happen under normal circumstances.
I can certainly fix the issue where the type parameter count for
Map
is incorrect via a code inspection, and in general my goal with IC2’s client-side static code analysis is pretty much what you’ve stated…to try to catch as many of the errors in the editor as possible to avoid the need for a deployment to find them. And for what are effectively semantic errors, i.e., things that aren’t caught by the Apex parser due to lack of grammar compliance but can be detected based on usage, e.g., type incompatibility, mismatched annotations/modifiers, incomplete concrete classes, etc., it’s getting pretty close. But for things that are effectively unhandled exceptions on the Salesforce servers, unfortunately there’s not much I can do.I’ll take care of the issue with a single type parameter for
Map
, though.