public static ParseException create ( List < ParseError > errors ) { if ( errors . size ( ) == 1 ) { return new ParseException ( errors . get ( 0 ) . getMessage ( ) , errors ) ; } else if ( errors . size ( ) > 1 ) { return new ParseException ( String . format ( "%d errors occured. First: %s" , errors . size ( ) , errors . get ( 0 ) . getMessage ( ) ) , errors ) ; } else { return new ParseException ( "An unknown error occured" , errors ) ; } }
Creates a new exception based on the list of errors .