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

fix: Remove try from non-throwing method calls #809

Merged
merged 3 commits into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ class EndpointResolverGenerator() {
writer.write("throw EndpointError.unresolved(error)")
}.write("")

writer.openBlock("guard let url = try crtResolvedEndpoint.getURL() else {", "}") {
writer.openBlock("guard let url = crtResolvedEndpoint.getURL() else {", "}") {
writer.write("assertionFailure(\"This must be a bug in either CRT or the rule engine, if the endpoint is not an error, it must have a url\")")
writer.write("throw EndpointError.unresolved(\"Failed to resolved endpoint\")")
}.write("")

writer.write("let headers = try crtResolvedEndpoint.getHeaders() ?? [:]")
writer.write("let properties = try crtResolvedEndpoint.getProperties() ?? [:]")
writer.write("let headers = crtResolvedEndpoint.getHeaders() ?? [:]")
writer.write("let properties = crtResolvedEndpoint.getProperties() ?? [:]")
writer.write("return try Endpoint(urlString: url, headers: Headers(headers), properties: properties)")
} ?: run {
writer.write("fatalError(\"EndpointResolver not implemented\")")
Expand Down