Tagged Questions

Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution.

learn more… | top users | synonyms

4
votes
1answer
50 views

Attempt at an implementation of a TextFile class

How can I improve this class that should represent a text file? Im trying to write a simple class to represent a text file - which one would think should be quite easy.. I don't intend to add all ...
6
votes
3answers
179 views

Exception handling, et al - How do I make this not “poor”?

I haven't done Java coding in years, but I thought I would give it a shot for a job interview. I have a few questions: Why is this error handling considered poor? How am I supposed to be doing it? ...
5
votes
1answer
148 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 ...
0
votes
0answers
32 views

How to handle specificity and exception in a huge program [closed]

'm trying to think about a method for handling specificity and exception. What I am trying to do is just a small part for the huge program, it is a big system. BTW, the system is build based on C++. ...
0
votes
0answers
46 views

Model View Control Issue: Null Pointer Initialization Question [closed]

Good morning again. This is David. Please, I need an urgent help regarding control model view where I making a code that uniquely separating into groups: An Activity Java Class to Display the ...
4
votes
2answers
84 views

Return inside try block

Is this return style acceptable? Would the code be more readable if I assigned the MonthDay.parse() return value to a variable and returned that variable on the last line? Also, is it a bad idea to ...
5
votes
3answers
124 views

Scala: a safer way to cut string

I want to get just the first line of a big string. Currently, here's how I do it: def getFirstParagraph(txt: String) = { val newLineIdx = txt.indexOf("\n") match { case i: Int if i > 0 ...
4
votes
3answers
124 views

Refactor this exception handling code

I am having difficulty deciding how to implement an exception handling strategy. I am using an observer pattern to allow "plugin" programmers to subscribe to Messages. These subscribers generally log ...
6
votes
4answers
294 views

Does this code follow standard conventions?

I’m trying to learn as much as I can on my own by reading lots of examples, documentations, and asking here. I would like to improve my style to write efficient code and adhere to Java standards. In ...
1
vote
2answers
110 views

Throwing the Exception But Using the Finally Block

Does this piece of code make sense? The idea is to throw any exceptions that may occur but always run the finally block to close the streams. private void streamToFile(HttpResponse transferResponse) ...
6
votes
3answers
247 views

When to catch a general exception

I have a class which throws alot of exceptions : try { mapper.writeValue(outStream, myVal); } catch (JsonGenerationException e) { e.printStackTrace(); } catch ...
1
vote
2answers
71 views

Add events dispatching for ActionScript framework Robotlegs

I have the following function in a Service class protected function writeToFile():void{ var destinationFile:File = File.applicationStorageDirectory.resolvePath(_newPath); var ...
2
votes
2answers
236 views

Encapsulating common Try-Catch code. Is this a known pattern? Is it good or bad?

In an effort to reduce code duplication, I often use and have used this style to capture handling of exceptions on a boundary of an application: Given the following extension methods: public static ...
2
votes
3answers
110 views

I think I'm not using Try Except properly in this Python code

Please offer some advice for this code. It all works, but I know that its messy and I don't think the Exception catching is doing what I want it to. Thanks in advance for any and all advice... def ...
1
vote
1answer
65 views

LPTHW - ex48 - Handling exceptions and unit testing

This is my solution to the exercise 48 of Learn Python the hard way by Zed Shaw. Please visit the link for testing suite and requirements. I'm worried about my the word banks I have created (COMPASS, ...

1 2 3
15 30 50 per page