Skip to content

Better error checking #10

@fingolfin

Description

@fingolfin

In a very naive attempt to try to use ferret to compute a normalizer), I entered this command (where G and H are permutation groups, and the goal was to compute N_G(H)).

gap> K:=Solve([ConInGroup(G), ConStabilize(Elements(H), OnSets)]); time;
Invalid attempt to read int
Error, Record Element: <rec> must be a record (not a boolean) in
  if record.generators = [ () ]  then
    retgrp := Group( () );
    StabChainMutable( retgrp );
else
    retgrp := Group( record.generators );
    SetStabChainMutable( retgrp, buildStabChain( record.generators, record.generators_map ) );
fi; at /Users/mhorn/Projekte/GAP/repos/pkg/ferret/lib/yapb.gi:526 called from
<function "Solve">( <arguments> )
 called from read-eval loop at *stdin*:188
you can replace <rec> via 'return <rec>;'

I believe the original source of the error is this line, resp. the lack of error checking before it:

  maxpoint := Maximum(List(constraints, x -> x.max));

The value of maxpoint ends up being a permutation.

So in retrospect, I understood that what I did was dumb. Still, I think ferret should catch this misuse, and report something sensible to the user.

Moreover, it seems that YAPB_SOLVE may return fail -- while ideally, one would catch all invalid input before invoking YAPB_SOLVE, that may not always be possible. In that case, fail could still be returned -- and hence I think it should be detected, and handled, instead of blinding treating its return value as a record.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions