Skip to content

Work in Progress: Error Messages

Jason Bertsche edited this page Jul 3, 2017 · 2 revisions

Prim Errors

Conceptual Stuff

This whole page is referring to the wip-middle-layer branch!

Even if it has to find the error partway through the prim for some reason (e.g. with running a lambda and failing when the lambda doesn't return a boolean), the prim can return a garbage value that indicates an error, and the middle layer can handle the error there.

The compiler needs to hand the token string of the prim into the middle layer, so that error messages know what to refer to the prim as. Runtime type errors need this, as do, for example these errors:

  • "Lists::ListButFirst3",
    • bf [] => ERROR BF got an empty list as input.
  • "Lists::ListButLast3",
    • bl [] => ERROR BL got an empty list as input.
  • "Strings::StrButFirst2",
    • bf "" => ERROR bf got an empty string as input.
  • "Strings::StrButLast2",
    • bl "" => ERROR bl got an empty string as input.

Since much work has been done on Tortoise/master since this was worked on, there will surely be new tests and prims that will need to be fixed, too.

Failing Reporters

  • "Lists::ListFirst1",
    • first [] => ERROR List is empty.
  • "Lists::ListReplaceIt2",
    • replace-item 0 [] [] => ERROR Can't find element 0 of the list [], which is only of length 0.
  • "Lists::ReduceEmpty",
    • reduce [?1 + ?2] [] => ERROR The list argument to reduce must not be empty.
  • "Lists::ListItem1",
    • item 0 [] => ERROR Can't find element 0 of the list [], which is only of length 0.
  • "Lists::ListItem2",
    • item 1 [1] => ERROR Can't find element 1 of the list [1], which is only of length 1.
  • "Lists::ListLast1",
    • last [] => ERROR List is empty.
  • "Lists::ListRemoveItem4",
    • remove-item 3 [1 2 3] => ERROR Can't find element 3 of the list [1 2 3], which is only of length 3.
  • "Lists::ListRemoveItem5",
    • remove-item -1 [1 2 3] => ERROR -1 isn't greater than or equal to zero.
  • "Lists::ListRemoveItem6",
    • remove-item 0 [] => ERROR Can't find element 0 of the list [], which is only of length 0.
  • "Lists::ListReplItem2",
    • replace-item -1 [2 7 4 5] 15 => ERROR -1 isn't greater than or equal to zero.
  • "Lists::ListReplItem3",
    • replace-item 4 [2 7 4 5] 15 => ERROR Can't find element 4 of the list [2 7 4 5], which is only of length 4.
  • "Lists::ListSubList6",
    • sublist [1 2] 1 0 => ERROR 0 is less than 1.
  • "Lists::ListSubList8",
    • sublist [1 2] 0 3 => ERROR 3 is greater than the length of the input list (2).
  • "Lists::ListSubList9",
    • sublist [1 2 3] -1 0 => ERROR -1 is less than zero.
  • "Lists::ListSubList12",
    • sublist [0 1] 10 15 => ERROR 15 is greater than the length of the input list (2).
  • "Numbers::Sqrt1",
    • sqrt -1 => ERROR The square root of -1 is an imaginary number.
  • "Numbers::Sqrt4",
    • sqrt -0.1 => ERROR The square root of -0.1 is an imaginary number.
  • "Numbers::Atan4",
    • atan 0 0 => ERROR atan is undefined when both inputs are zero.
  • "Numbers::Exponentiation3",
    • -1 ^ 0.5 => ERROR math operation produced a non-number
  • "Numbers::Log5",
    • log 9 0 => ERROR 0 isn't a valid base for a logarithm.
  • "Numbers::Log6",
    • log 9 -2 => ERROR -2 isn't a valid base for a logarithm.
  • "Numbers::Max1",
    • max [] => ERROR Can't find the maximum of a list with no numbers: []
  • "Numbers::Min1",
    • min [] => ERROR Can't find the minimum of a list with no numbers: []
  • "Numbers::Mean1",
    • mean [] => ERROR List is empty.
  • "Numbers::Variance1",
    • variance [] => ERROR Can't find the variance of a list without at least two numbers: [].
  • "Numbers::Variance2",
    • variance [5] => ERROR Can't find the variance of a list without at least two numbers: [5].
  • "Strings::StrRemoveItem4",
    • remove-item 3 "123" => ERROR Can't find element 3 of the string 123, which is only of length 3.
  • "Strings::StrRemoveItem5",
    • remove-item -1 "123" => ERROR -1 isn't greater than or equal to zero.
  • "Strings::StrRemoveItem6"
    • remove-item 0 "" => ERROR Can't find element 0 of the string , which is only of length 0.

Failing Commands

  • "Agentsets::Agentsets3",

    • count (n-of 1 turtles) => ERROR Requested 1 random agents from a set of only 0 agents.
    • count (n-of -1 patches) => ERROR First input to N-OF can't be negative.
  • "Agentsets::LinkAgentsetDeadLinks",

    • n-of 5 glob1 => ERROR Requested 5 random agents from a set of only 0 agents.
  • "Breeds::SetBreedToNonBreed",

    • O> crt 1 [ set breed patches ] => ERROR You can't set BREED to a non-breed agentset.
  • "Death::DeadTurtles1",

    • ...
      • All sorts of crap that should leave the engine shouting, "That mouse is dead."
  • "Death::DeadTurtles2",

    • ...
      • All sorts of crap that should leave the engine shouting, "That mouse is dead."
  • "Interaction::Interaction13",

    • O> crt 2 [towards turtle 1] of turtle 0 => ERROR No heading is defined from a point (0,0) to that same point. [towardsxy 0 0] of turtle 0 => ERROR No heading is defined from a point (0,0) to that same point. [towards patch-here] of turtle 0 => ERROR No heading is defined from a point (0,0) to that same point.
  • "Links::CreateLinksTo",

    • T> create-directed-links-to other turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
    • T> create-directed-link-to one-of turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
  • "Links::CreateLinksFrom",

    • T> create-directed-links-from other turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
    • T> create-directed-link-from one-of turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
  • "Links::CreateLinksWith",

    • T> create-undirected-links-with other turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
    • T> create-undirected-link-with one-of turtles => ERROR You cannot have both breeded and unbreeded links in the same world.
  • "Links::LinkFromToWith1",

    • [link-with turtle 1] of turtle 0 => ERROR LINKS is a directed breed.
    • [link-with turtle 0] of turtle 1 => ERROR LINKS is a directed breed.
  • "Links::LinkCantChangeBreeds",

    • O> ask glob1 [ set breed frogs ] => ERROR You can't set BREED to a non-link-breed agentset.
  • "Links::BadLinkBreeds",

    • L> set breed turtles => ERROR You can't set BREED to a non-link-breed agentset.
    • L> set breed frogs => ERROR You can't set BREED to a non-link-breed agentset.
    • L> set breed directed-links => ERROR You cannot have both breeded and unbreeded links in the same world.
    • L> set breed undirected-links => ERROR there is already a UNDIRECTED-LINK with endpoints turtle 0 and turtle 1
    • L> set breed links => ERROR You cannot have both breeded and unbreeded links in the same world.
  • "Links::LinkNeighborIsUndirectedOnly1",

    • T> __ignore link-neighbor? one-of other turtles => ERROR LINKS is a directed breed.
  • "Math::CatchNumbersOutsideDoubleRangeOfIntegers",

    • O> __ignore random 1E16 => ERROR 1.0E16 is too large to be represented exactly as an integer in NetLogo
    • O> __ignore random -1E16 => ERROR -1.0E16 is too large to be represented exactly as an integer in NetLogo
  • "Patch::SetVariableRuntime",

    • O> ask patch 0 0 [ set pcolor self ] => ERROR can't set patch variable PCOLOR to non-number (patch 0 0)
  • "RGB::PatchesRGBColor", "RGB::TurtlesRGBColor", "RGB::LinksRGBColor",

    • O> ask glob1 [ set pcolor [0 0 0 0] ] => ERROR An rgb list must contain 3 numbers 0-255
    • O> ask glob1 [ set pcolor [0 0 [0]] ] => ERROR An rgb list must contain 3 numbers 0-255
    • O> ask glob1 [ set pcolor [500 0 0] ] => ERROR RGB values must be 0-255
    • O> ask glob1 [ set pcolor [-1 0 0] ] => ERROR RGB values must be 0-255
  • "Random::RandomOneOfWithLists",

    • one-of [] => ERROR ONE-OF got an empty list as input.
      • ListPrims.oneOf
  • "Random::RandomNOfWithLists",

    • n-of -1 [] => ERROR First input to N-OF can't be negative.
    • n-of -1 [1 2 3] => ERROR First input to N-OF can't be negative.
    • n-of 1 [] => ERROR Requested 1 random items from a list of length 0.
      • ListPrims.nOf
  • "Random::RejectBadSeeds",

    • O> random-seed 2147483648 => ERROR 2147483648 is not in the allowable range for random seeds (-2147483648 to 2147483647)
    • O> random-seed -2147483649 => ERROR -2147483649 is not in the allowable range for random seeds (-2147483648 to 2147483647)
    • O> random-seed 1.0E38 => ERROR 1.0E38 is not in the allowable range for random seeds (-2147483648 to 2147483647)
    • O> random-seed -1.0E38 => ERROR -1.0E38 is not in the allowable range for random seeds (-2147483648 to 2147483647)
      • Does this restriction need to exist in JS?
        • workspace.rng.setSeed
  • "Run::RunRejectExtraArgumentsIfFirstArgIsString",

    • O> (run "__ignore 5" 1) => ERROR run doesn't accept further inputs if the first is a string
      • Prims.run
  • "Run::RunResultRejectExtraArgumentsIfFirstArgIsString",

    • O> __ignore (runresult "5" 1) => ERROR runresult doesn't accept further inputs if the first is a string
      • Prims.runresult
  • "Sort::sort-by-catches-java-7-general-contract-violation-error",

    • err => "predicate is not a strictly-less-than or strictly-greater than relation"
      • Run this test (which means switching off the branch, since it's broken)
        • Does it generate the 'Comparison method violates its general contract' message somehow...?
        • This only affects sort-by.
          • ListPrims.sortBy
  • "Turtles::Turtles1a",

    • turtle -0.1 => ERROR -0.1 is not an integer
    • turtle 0.1 => ERROR 0.1 is not an integer
    • turtle 0.9 => ERROR 0.9 is not an integer
    • turtle 1.1 => ERROR 1.1 is not an integer
    • frog 0 => ERROR turtle 0 is not a FROG
    • mouse 0 => ERROR turtle 0 is not a MOUSE
    • frog -0.1 => ERROR -0.1 is not an integer
    • frog 0.1 => ERROR 0.1 is not an integer
    • frog 0.9 => ERROR 0.9 is not an integer
    • frog 1.1 => ERROR 1.1 is not an integer
    • mouse 0 => ERROR frog 0 is not a MOUSE
    • mouse 0.0 => ERROR frog 0 is not a MOUSE
    • frog 1 => ERROR turtle 1 is not a FROG
    • frog 1.0 => ERROR turtle 1 is not a FROG
      • world.turtleManager.getTurtle
      • world.turtleManager.turtlesOfBreed

Requires Dealing with NetLogo Lunacy

  • "Death::DeadTurtles5",
    • O> ask turtle 0 [ set glob1 foo ] => ERROR the FOO procedure failed to report a result
      • Crazy case where turtle kills itself by running ask code...
  • "Death::DeadTurtles6",
    • O> ask turtle 0 [ set glob1 foo ] => ERROR the FOO procedure failed to report a result
      • Crazy case where turtle kills itself by running ask code...

Prims That Still Need Redirecting

  • ask
  • atan
  • create-link-from
  • create-links-from
  • create-links-to
  • create-links-with
  • create-link-to
  • create-link-with
  • first
  • in-link-from
  • in-link-neighbor?
  • in-link-neighbors
  • item
  • last
  • link-neighbor?
  • link-neighbors
  • link-with
  • log
  • max
  • mean
  • min
  • my-in-links
  • my-links
  • my-out-links
  • n-of
  • of
  • out-link-neighbor?
  • out-link-neighbors
  • out-link-to
  • reduce
  • remove-item (and list/string type split for this one)
  • replace-item
  • set (agent variable)
  • sublist
  • variance