@@ -259,24 +259,28 @@ impl ErrorImpl {
259259
260260 fn debug ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
261261 match self {
262- ErrorImpl :: Message ( msg, pos) => f. debug_tuple ( "Message" ) . field ( msg) . field ( pos) . finish ( ) ,
263- ErrorImpl :: Libyaml ( err) => f. debug_tuple ( "Libyaml" ) . field ( err) . finish ( ) ,
264- ErrorImpl :: Io ( io) => f. debug_tuple ( "Io" ) . field ( io) . finish ( ) ,
265- ErrorImpl :: FromUtf8 ( from_utf8) => f. debug_tuple ( "FromUtf8" ) . field ( from_utf8) . finish ( ) ,
266- ErrorImpl :: EndOfStream => f. write_str ( "EndOfStream" ) ,
267- ErrorImpl :: MoreThanOneDocument => f. write_str ( "MoreThanOneDocument" ) ,
268- ErrorImpl :: RecursionLimitExceeded ( mark) => {
269- f. debug_tuple ( "RecursionLimitExceeded" ) . field ( mark) . finish ( )
270- }
271- ErrorImpl :: RepetitionLimitExceeded => f. write_str ( "RepetitionLimitExceeded" ) ,
272- ErrorImpl :: BytesUnsupported => f. write_str ( "BytesUnsupported" ) ,
273- ErrorImpl :: UnknownAnchor ( mark) => f. debug_tuple ( "UnknownAnchor" ) . field ( mark) . finish ( ) ,
274- ErrorImpl :: SerializeNestedEnum => f. write_str ( "SerializeNestedEnum" ) ,
275- ErrorImpl :: ScalarInMerge => f. write_str ( "ScalarInMerge" ) ,
276- ErrorImpl :: TaggedInMerge => f. write_str ( "TaggedInMerge" ) ,
277- ErrorImpl :: ScalarInMergeElement => f. write_str ( "ScalarInMergeElement" ) ,
278- ErrorImpl :: SequenceInMergeElement => f. write_str ( "SequenceInMergeElement" ) ,
262+ ErrorImpl :: Libyaml ( err) => Debug :: fmt ( err, f) ,
279263 ErrorImpl :: Shared ( err) => err. debug ( f) ,
264+ _ => {
265+ f. write_str ( "Error(" ) ?;
266+ struct MessageNoMark < ' a > ( & ' a ErrorImpl ) ;
267+ impl < ' a > Display for MessageNoMark < ' a > {
268+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
269+ self . 0 . message_no_mark ( f)
270+ }
271+ }
272+ let msg = MessageNoMark ( self ) . to_string ( ) ;
273+ Debug :: fmt ( & msg, f) ?;
274+ if let Some ( mark) = self . mark ( ) {
275+ write ! (
276+ f,
277+ ", line: {}, column: {}" ,
278+ mark. line( ) + 1 ,
279+ mark. column( ) + 1 ,
280+ ) ?;
281+ }
282+ f. write_str ( ")" )
283+ }
280284 }
281285 }
282286}
0 commit comments