Skip to content

Create GlowErr type with informational error code enum #2283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 21, 2019

Conversation

jackm321
Copy link
Contributor

Description:
Create an llvm::Error that holds a string and/or an enum that classifies the error so that this information can be used to send correct ONNXIFI statuses.
In followups, handle error codes to send ONNXIFI statuses. Use error codes in the rest of model loading stack.
Testing:
ninja all
Documentation:
doxygen

@jackm321 jackm321 requested a review from rdzhabarov January 18, 2019 18:05
@jackm321 jackm321 changed the title Create Error types Create GlowErr type with informational error code enum Jan 18, 2019
Copy link
Contributor

@jfix71 jfix71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

}
}

GlowErr(llvm::StringRef fileName, int32_t lineNumber, llvm::StringRef message,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lineNumber is int32_t, while lineNumber_ is size_t.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dang, thanks!

return llvm::formatv("Error at file {0} line {1} \"{2}\"", file, line, str);
}

char GlowErr::ID = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining what this is for?

Copy link
Contributor

@rdzhabarov rdzhabarov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

class GlowErr final : public llvm::ErrorInfo<GlowErr> {
public:
/// Used by ErrorInfo::classID.
static char ID;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make that uint8_t.

static char ID;
/// An enumeration of error codes representing various possible errors that
/// could occur.
enum EC {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be enum class and also no need to explicit values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ErrorCode would be more descriptive.

@jackm321 jackm321 merged commit 232e4d4 into pytorch:master Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants