Skip to content

Commit

Permalink
Merge pull request #34 from gap-packages/mh/error-concat
Browse files Browse the repository at this point in the history
Simplify some 'Error' invocations
  • Loading branch information
gaehler authored Dec 20, 2023
2 parents 93cd688 + 5a7e8dc commit 1157ce5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions gap/carat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ InstallGlobalFunction( CaratShowFile, function( filename )
local input;
input := InputTextFile( filename );
if input = fail then
Error( Concatenation( "File ", filename, " not found." ) );
Error( "File ", filename, " not found." );
fi;
Print( ReadAll( input ) );
CloseStream( input );
Expand Down Expand Up @@ -615,7 +615,7 @@ InstallGlobalFunction( CaratCommand, function( command, args, outfile )
# find executable
program := Filename( CARAT_BIN_DIR, command );
if program = fail then
Error( Concatenation( "Carat program ", command, " not found." ) );
Error( "Carat program ", command, " not found." );
fi;

# execute command
Expand All @@ -630,13 +630,12 @@ InstallGlobalFunction( CaratCommand, function( command, args, outfile )
CaratShowFile( outfile ); # contains usage advice
else
CaratShowFile( outfile );
Error( Concatenation( "Carat program ", command,
" failed with error code ", String(err), " and the above output" ) );
Error( "Carat program ", command,
" failed with error code ", err, " and the above output" );
fi;
fi;
if err < 0 and args <> "-h" then
Error( Concatenation( "Carat program ", command,
" failed with error code ", String(err) ) );
Error( "Carat program ", command, " failed with error code ", err );
fi;

end );
Expand Down
8 changes: 3 additions & 5 deletions gap/methods.gi
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ InstallGlobalFunction( BravaisGroupsCrystalFamily, function( symb )
command := "Bravais_catalog";
program := Filename( CARAT_BIN_DIR, command );
if program = fail then
Error( Concatenation( "Carat program ", command, " not found." ) );
Error( "Carat program ", command, " not found." );
fi;

# execute command
Expand All @@ -474,8 +474,7 @@ InstallGlobalFunction( BravaisGroupsCrystalFamily, function( symb )
CaratShowFile( resfile ); # contains usage advice
fi;
if err < 0 then
Error( Concatenation( "Carat program ", command,
" failed with error code ", String(err) ) );
Error( "Carat program ", command, " failed with error code ", err );
fi;

# read Carat result from file, and remove temporary file
Expand Down Expand Up @@ -564,8 +563,7 @@ InstallGlobalFunction( CaratQClassCatalog, function( grp , mode )
# get the QClass name
str := CaratReadLine( input );
if str{[1..22]} <> "Name of this Q-class: " then
Error( Concatenation(
"Carat program Q_catalog failed with message\n", str ) );
Error( "Carat program Q_catalog failed with message\n", str );
fi;
res.qclass := str{[23..Length(str)-1]};

Expand Down

0 comments on commit 1157ce5

Please sign in to comment.