How do I get ruby to print a full backtrace instead of a truncated one?

When I get exceptions, it is often from deep within the call stack. When this happens, more often than not, the actual offending line of code is hidden from me: tmp.rb:7:in `t’: undefined method `bar’ for nil:NilClass (NoMethodError) from tmp.rb:10:in `s’ from tmp.rb:13:in `r’ from tmp.rb:16:in `q’ from tmp.rb:19:in `p’ from tmp.rb:22:in `o’ from tmp.rb:25:in … Read more

Proper use of errors

I’m using TypeScript for a reasonably large project, and am wondering what the standard is for the use of Errors. For example, say I hand an index out of bounds exception in Java: throw new IndexOutOfBoundsException(); Would the equivalent statement in TypeScript be: throw new Error(“Index Out of Bounds”); What other ways could I accomplish … Read more

java.net.MalformedURLException: no protocol

I am getting Java exception like: java.net.MalformedURLException: no protocol My program is trying to parse an XML string by using: Document dom; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); dom = db.parse(xml); The XML string contains: String xml = “<?xml version=\”1.0\” encoding=\”utf-8\”?>”+ ” <s:Envelope xmlns:s=\”http://schemas.xmlsoap.org/soap/envelope/\”>”+ ” <s:Header>”+ ” <ActivityId CorrelationId=\”15424263-3c01-4709-bec3-740d1ab15a38\” xmlns=\”http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics\”>50d69ff9-8cf3-4c20-afe5-63a9047348ad</ActivityId>”+ ” <clalLog_CorrelationId xmlns=\”http://clalbit.co.il/clallog\”>eb791540-ad6d-48a3-914d-d74f57d88179</clalLog_CorrelationId>”+ … Read more

Causes of getting a java.lang.VerifyError

I’m investigating the following java.lang.VerifyError java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: (IILjava/util/Collection;Ljava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/util/MessageRe˜̴MtÌ´MÚw€mçw€mp:”MŒŒ at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) It occurs when the jboss server in which the servlet is deployed is started. It is compiled with jdk-1.5.0_11 and I tried to recompile it with jdk-1.5.0_15 without succes. That is the compilation runs fine but … Read more

How to handle AccessViolationException

I am using a COM object (MODI) from within my .net application. The method I am calling throws a System.AccessViolationException, which is intercepted by Visual Studio. The odd thing is that I have wrapped my call in a try catch, which has handlers for AccessViolationException, COMException and everything else, but when Visual Studio (2010) intercepts … Read more

How using try catch for exception handling is best practice

while maintaining my colleague’s code from even someone who claims to be a senior developer, I often see the following code: try { //do something } catch { //Do nothing } or sometimes they write logging information to log files like following try catch block try { //do some work } catch(Exception exception) { WriteException2LogFile(exception); … Read more

Why not use exceptions as regular flow of control?

To avoid all standard-answers I could have Googled on, I will provide an example you all can attack at will. C# and Java (and too many others) have with plenty of types some of ‘overflow’ behaviour I don’t like at all (e.g type.MaxValue + type.SmallestValue == type.MinValue for example : int.MaxValue + 1 == int.MinValue). … Read more

Could not load file or assembly … The parameter is incorrect

Recently I met the following exception at C# solution: Error 2 Could not load file or assembly ‘Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b9a188c8922137c6’ or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) This does not depend either on my code or on the name of assembly (like Newtonsoft.Json in this case). When … Read more