Skip to content
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

Raise an error when cannot parse identifier from title #175

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

mico
Copy link
Contributor

@mico mico commented Dec 18, 2022

closes #163

@mico mico requested review from ronaldtse and andrew2net December 18, 2022 08:45
@@ -134,6 +134,8 @@ def self.parse_from_title(title)
# delete parts from the title until it's parseable
acc.reverse.sub(part.reverse, "").reverse.strip
end

raise Errors::ParseError, "cannot parse #{title}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have more specific errors such as “InvalidPrefixError” (for disallowed prefixes), “InvalidTypedStageError” etc? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we have more specific errors such as “InvalidPrefixError” (for disallowed prefixes), “InvalidTypedStageError” etc? Thanks.

Parsing error is a result of Parslet's parsing error Parslet::ParseFailed, there are no way to extract the cause of error, only by reading long error message.
To get specific error, we need to change parsing and parse it step by step, could be quite challenging tasks because of many formats.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's merge this first and then deal with more fine grained errors. Thanks.

@mico mico requested a review from ronaldtse December 20, 2022 07:36
@ronaldtse ronaldtse merged commit 919fbec into main Dec 20, 2022
@ronaldtse ronaldtse deleted the parse-from-title-raise-error branch December 20, 2022 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#parse_from_title returns an empty string
3 participants