All Questions
Tagged with scala error-handling
13 questions
1
vote
1
answer
44
views
Page download with reattempts in Scala
I wrote the following code to deal with possible network problems.
...
0
votes
1
answer
82
views
Report a status based on a list of results
In one of my services, I have the function as presented below:
...
1
vote
1
answer
150
views
Parsing latitude and longitude, using Try[T] to ignore errors
I wrote this question asking about how to implement my error handling while still maintaining functional code and based on 200_success's very interesting note on the spaces, I decided to ...
1
vote
1
answer
220
views
Implementation of API to create a company account in a database
I'm working on an API that has a lot of controller functions like this:
...
2
votes
1
answer
51
views
Pushing data to an analytics API
This is code that handles pushing data to an analytics API, and IMO it feels too much like Java.
logActivity is a method that uses ...
2
votes
1
answer
98
views
Print Trace Debugger
Notice: The original library has since been replaced by:
https://github.com/JohnReedLOL/scala-trace-debug
See my Scala print trace debugger. This project is used for lightweight debugging sort of ...
3
votes
1
answer
2k
views
Playframework (Scala) custom exception handling
I am using play framework with scala and here is a scenario on which I would like to have your opinion.
Let's say I have 2 ...
3
votes
2
answers
285
views
2
votes
2
answers
2k
views
Branching with multiple Try
I have a series of four method calls that all return Try[Something], with the last returning Try[Unit]. Something like this:
...
8
votes
2
answers
906
views
Idiomatic Scala try option code block
Basically, this function returns a list of flights for an airline. But if the airline doesn't exist, I want to throw some custom runtime exception. If that airline does exist, I want to return a list ...
3
votes
2
answers
348
views
Adding two values in a map, if they exist
My code looks like imperative style code. I want to make my code more functional. How I can rewrite my program so it become functional style code?
...
7
votes
2
answers
7k
views
Handling parsing failure in Scala without exceptions
I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...
6
votes
3
answers
3k
views
A safer way to cut a string
I want to get just the first line of a big string. Currently, here's how I do it:
...