Skip to content

error checks in C++ but not Python #247

Closed

Description

@yakra

siteupdate.cpp

el.add_error("Could not parse updates.csv line: [" + line + "], expected 5 fields, found 1");
el.add_error("Could not parse systemupdates.csv line: [" + line + "], expected 5 fields, found 1");

Route.cpp (the 2nd & 3rd tie into #56)

el.add_error("Unrecognized region in " + system->systemname + ".csv line: [" + line + "], " + line.substr(left+1, right-left-1));
el.add_error("Banner >6 characters in " + system->systemname + ".csv line: [" + line + "], " + banner);
el.add_error("Abbrev >3 characters in " + system->systemname + ".csv line: [" + line + "], " + abbrev);

ConnectedRoute.cpp (#56 again)

el.add_error("Banner >6 characters in " + system->systemname + "_con.csv line: [" + line + "], " + banner);

HighwaySystem.cpp

el.add_error("Could not find country matching " + systemsfile + " line: " + line);

Activity

  1. yakra commented on Mar 24, 2020

    @yakra
    ContributorAuthor
  2. yakra commented on Mar 27, 2020

    @yakra
    ContributorAuthor

    else el.add_error("Error opening user list file path \""+args.userlistfilepath+"\". (Not found?)");

    use try/except/else


    Conversely, make sure every except in Python is similarly included in C++.

  3. yakra commented on Apr 2, 2020

    @yakra
    ContributorAuthor
    • Check every instance of "pars" in both versions
      • use el.add_error wherever appropriate.
      • expected...found
  4. yakra commented on Apr 3, 2020

    @yakra
    ContributorAuthor

    Everything listed here is addressed in the draft in my working directory.
    #247 (comment) :P

  5. yakra commented on Apr 3, 2020

    @yakra
    ContributorAuthor

    Rather than add in a second warning/notification when it's time to read the .lists (and not just read the directory contents), a crash is as good a notification as any. :P

    Start: 2020-04-03 10:48:24.410887
    Traceback (most recent call last):
      File "./siteupdate.py", line 2138, in <module>
        traveler_ids = os.listdir(args.userlistfilepath) if traveler_ids is None else (id + ".list" for id in traveler_ids)
    FileNotFoundError: [Errno 2] No such file or directory: '/home/yakra/BreakMe/UserData/list_files'
    
  6. yakra commented on Apr 4, 2020

    @yakra
    ContributorAuthor

    New business:

    if (tier < 1) el.add_error("Invalid tier in " + systemsfile + " line " + line);

    Edit: Done.

            # verify Tier field
            try:
                fields[4] = int(fields[4])
            except ValueError:
                el.add_error("Invalid tier in " + systemsfile + " line " + line)
            else:
                if fields[4] < 1:
                    el.add_error("Invalid tier in " + systemsfile + " line " + line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions