diff options
Diffstat (limited to 'language-web/src/main/js/xtext')
-rw-r--r-- | language-web/src/main/js/xtext/ServiceBuilder.js | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/language-web/src/main/js/xtext/ServiceBuilder.js b/language-web/src/main/js/xtext/ServiceBuilder.js index 38b08ecc..57fcb310 100644 --- a/language-web/src/main/js/xtext/ServiceBuilder.js +++ b/language-web/src/main/js/xtext/ServiceBuilder.js | |||
@@ -18,10 +18,11 @@ define([ | |||
18 | 'xtext/services/ContentAssistService', | 18 | 'xtext/services/ContentAssistService', |
19 | 'xtext/services/HoverService', | 19 | 'xtext/services/HoverService', |
20 | 'xtext/services/OccurrencesService', | 20 | 'xtext/services/OccurrencesService', |
21 | 'xtext/services/FormattingService' | 21 | 'xtext/services/FormattingService', |
22 | '../logging', | ||
22 | ], function(jQuery, XtextService, LoadResourceService, SaveResourceService, HighlightingService, | 23 | ], function(jQuery, XtextService, LoadResourceService, SaveResourceService, HighlightingService, |
23 | ValidationService, UpdateService, ContentAssistService, HoverService, OccurrencesService, | 24 | ValidationService, UpdateService, ContentAssistService, HoverService, OccurrencesService, |
24 | FormattingService) { | 25 | FormattingService, logging) { |
25 | 26 | ||
26 | /** | 27 | /** |
27 | * Builder class for the Xtext services. | 28 | * Builder class for the Xtext services. |
@@ -179,12 +180,22 @@ define([ | |||
179 | }); | 180 | }); |
180 | } | 181 | } |
181 | 182 | ||
182 | services.successListeners = []; | 183 | const log = logging.getLoggerFromRoot('xtext.XtextService'); |
184 | services.successListeners = [function(serviceType, result) { | ||
185 | if (log.getLevel() <= log.levels.TRACE) { | ||
186 | log.trace('service', serviceType, 'request success', JSON.parse(JSON.stringify(result))); | ||
187 | } | ||
188 | }]; | ||
183 | services.errorListeners = [function(serviceType, severity, message, requestData) { | 189 | services.errorListeners = [function(serviceType, severity, message, requestData) { |
184 | if (options.showErrorDialogs) | 190 | const messageParts = ['service', serviceType, 'failed:', message || '(no message)']; |
185 | window.alert('Xtext service \'' + serviceType + '\' failed: ' + message); | 191 | if (requestData) { |
186 | else | 192 | messageParts.push(JSON.parse(JSON.stringify(requestData))); |
187 | console.log('Xtext service \'' + serviceType + '\' failed: ' + message); | 193 | } |
194 | if (severity === 'warning') { | ||
195 | log.warn(...messageParts); | ||
196 | } else { | ||
197 | log.error(...messageParts); | ||
198 | } | ||
188 | }]; | 199 | }]; |
189 | } | 200 | } |
190 | 201 | ||
@@ -271,4 +282,4 @@ define([ | |||
271 | } | 282 | } |
272 | 283 | ||
273 | return ServiceBuilder; | 284 | return ServiceBuilder; |
274 | }); \ No newline at end of file | 285 | }); |