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
[br] 1st translation of "Exceptions.md" #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obrigado. Fiz algumas correções.
| Define NewExcep | `struct NewExcep <: Exception`<br>`v::String`<br>`end`<br><br>`Base.showerror(io::IO, e::NewExcep) = print(io, "A problem with $(e.v)!")`<br><br>`throw(NewExcep("x"))` | | ||
| Throw error with msg text | `error(msg)` | | ||
| Handler | `try`<br>`# do something potentially iffy`<br>`catch ex`<br>`if isa(ex, SomeExcep)`<br>`# handle SomeExcep`<br>`elseif isa(ex, AnotherExcep)`<br>`# handle AnotherExcep`<br>`else`<br>`# handle all others`<br>`finally`<br>`# do this in any case`<br>`end` | | ||
| Lançar algumas exceções | `throw(SomeExcep())` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lançar AlgumaExcecao. Do lado direito SomeExcep -> AlgumaExcecao
| Handler | `try`<br>`# do something potentially iffy`<br>`catch ex`<br>`if isa(ex, SomeExcep)`<br>`# handle SomeExcep`<br>`elseif isa(ex, AnotherExcep)`<br>`# handle AnotherExcep`<br>`else`<br>`# handle all others`<br>`finally`<br>`# do this in any case`<br>`end` | | ||
| Lançar algumas exceções | `throw(SomeExcep())` | | ||
| Relançar exceção atual | `rethrow()` | | ||
| Definir NewExcep | `struct NewExcep <: Exception`<br>`v::String`<br>`end`<br><br>`Base.showerror(io::IO, e::NewExcep) = print(io, "A problem with $(e.v)!")`<br><br>`throw(NewExcep("x"))` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traduzir NewExcep
| Lançar algumas exceções | `throw(SomeExcep())` | | ||
| Relançar exceção atual | `rethrow()` | | ||
| Definir NewExcep | `struct NewExcep <: Exception`<br>`v::String`<br>`end`<br><br>`Base.showerror(io::IO, e::NewExcep) = print(io, "A problem with $(e.v)!")`<br><br>`throw(NewExcep("x"))` | | ||
| Erro de lançamento com mensagem | `error(msg)` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lançar erro com mensagem
| Relançar exceção atual | `rethrow()` | | ||
| Definir NewExcep | `struct NewExcep <: Exception`<br>`v::String`<br>`end`<br><br>`Base.showerror(io::IO, e::NewExcep) = print(io, "A problem with $(e.v)!")`<br><br>`throw(NewExcep("x"))` | | ||
| Erro de lançamento com mensagem | `error(msg)` | | ||
| Handler | `try`<br>`# do something potentially iffy`<br>`catch ex`<br>`if isa(ex, SomeExcep)`<br>`# handle SomeExcep`<br>`elseif isa(ex, AnotherExcep)`<br>`# handle AnotherExcep`<br>`else`<br>`# handle all others`<br>`finally`<br>`# do this in any case`<br>`end` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tratamento,
fazer algo potencialmente errado
SomeExcep -> AlgumaExcecao
lidar com AlgumaExcecao
AnotherExcep -> OutraExcecao
lidar com todas outras
Faça isto em todos casos
No description provided.