1
1
import * as _ from "lodash" ;
2
2
import pMap from "p-map" ;
3
3
import "source-map-support/register" ;
4
- import * as VError from "verror" ;
5
4
import {
6
5
commands , CompletionItem , CompletionItemKind , Disposable ,
7
6
ExtensionContext , languages , Location , Position , Range , TextDocument , Uri , window ,
@@ -74,7 +73,7 @@ async function performCache(): Promise<void> {
74
73
} , { concurrency : 30 } ) ;
75
74
} catch ( err ) {
76
75
notifier . notify ( "alert" , "Failed to cache the CSS classes in the workspace (click for another attempt)" ) ;
77
- throw new VError ( err as any , "Failed to parse the documents" ) ;
76
+ throw new Error ( "Failed to parse the documents" , { cause : err } ) ;
78
77
}
79
78
80
79
uniqueDefinitions = _ . uniqBy ( definitions , ( def ) => def . className ) ;
@@ -89,8 +88,7 @@ async function performCache(): Promise<void> {
89
88
notifier . notify ( "zap" , "CSS classes cached (click to cache again)" ) ;
90
89
} catch ( err ) {
91
90
notifier . notify ( "alert" , "Failed to cache the CSS classes in the workspace (click for another attempt)" ) ;
92
- throw new VError ( err as any ,
93
- "Failed to cache the class definitions during the iterations over the documents that were found" ) ;
91
+ throw new Error ( "Failed to cache the class definitions during the iterations over the documents that were found" , { cause : err } ) ;
94
92
}
95
93
}
96
94
@@ -283,7 +281,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
283
281
registerJavaScriptProviders ( javaScriptDisposables ) ;
284
282
}
285
283
} catch ( err ) {
286
- const newErr = new VError ( err as any , "Failed to automatically reload the extension after the configuration change" ) ;
284
+ const newErr = new Error ( "Failed to automatically reload the extension after the configuration change" , { cause : err } ) ;
287
285
console . error ( newErr ) ;
288
286
window . showErrorMessage ( newErr . message ) ;
289
287
}
@@ -294,7 +292,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
294
292
try {
295
293
await cache ( ) ;
296
294
} catch ( err ) {
297
- const newErr = new VError ( err as any , "Failed to cache the CSS classes in the workspace" ) ;
295
+ const newErr = new Error ( "Failed to cache the CSS classes in the workspace" , { cause : err } ) ;
298
296
console . error ( newErr ) ;
299
297
window . showErrorMessage ( newErr . message ) ;
300
298
}
@@ -317,7 +315,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
317
315
try {
318
316
await cache ( ) ;
319
317
} catch ( err ) {
320
- const newErr = new VError ( err as any , "Failed to cache the CSS classes in the workspace for the first time" ) ;
318
+ const newErr = new Error ( "Failed to cache the CSS classes in the workspace for the first time" , { cause : err } ) ;
321
319
console . error ( newErr ) ;
322
320
window . showErrorMessage ( newErr . message ) ;
323
321
}
0 commit comments