File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to the "prettier-vscode" extension will be documented in thi
44
55<!-- Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. -->
66
7+ ## [ 5.1.3]
8+
9+ - Improved error output of certain plugin exceptions.
10+
711## [ 5.1.2]
812
913- Added error logging for unusual prettier exceptions.
Original file line number Diff line number Diff line change 22 "name" : " prettier-vscode" ,
33 "displayName" : " Prettier - Code formatter" ,
44 "description" : " Code formatter using prettier" ,
5- "version" : " 5.1.2 " ,
5+ "version" : " 5.1.3 " ,
66 "publisher" : " esbenp" ,
77 "author" : " Prettier <@prettiercode>" ,
88 "galleryBanner" : {
Original file line number Diff line number Diff line change @@ -46,21 +46,23 @@ export class LoggingService {
4646 }
4747 }
4848
49- public logError ( message : string , error ?: Error ) {
49+ public logError ( message : string , error ?: Error | string ) {
5050 if ( this . logLevel === "NONE" ) {
5151 return ;
5252 }
5353 this . logMessage ( message , "ERROR" ) ;
54- if ( error ?. message || error ?. stack ) {
55- // Try to print the most useful error message
54+ if ( typeof error === "string" ) {
55+ // Errors as a string usually only happen with
56+ // plugins that don't return the expected error.
57+ this . outputChannel . appendLine ( error ) ;
58+ } else if ( error ?. message || error ?. stack ) {
5659 if ( error ?. message ) {
5760 this . logMessage ( error . message , "ERROR" ) ;
5861 }
5962 if ( error ?. stack ) {
6063 this . outputChannel . appendLine ( error . stack ) ;
6164 }
6265 } else if ( error ) {
63- // Weird error returned, just output the whole thing
6466 this . logObject ( error ) ;
6567 }
6668 }
You can’t perform that action at this time.
0 commit comments