Flutter - How to get error code line : "Another exception was thrown" - debugging

When I run my application, I get an error:
Another exception was thrown: type 'String' is not a subtype of type 'int' of 'index'
My android screen immediately red with the error above, but only a few moments. After that back to normal. What I want to ask is, how can I know which line is error?

are there any values on your code that could be null at some point in time?
like if you are getting a price try to give that value except for null.
if something is like this:
Text(price);
change it to:
Text(price !=null ? 'your price' : "nothing!")
in the picture I see a null value, maybe that's causing the problem. you can also put prints on your code to track that down. you should also check the beginning of errors. that might help too!

Related

Error: Unknown slot type 'LIST_OF_COLORS' for slot 'Color'

Hi while following the tutorial: https://developer.amazon.com/de/alexa-skills-kit/alexa-skill-quick-start-tutorial
for building Alexa Skills I run into the following exception:
Error: There was a problem with your request: Unknown slot type 'LIST_OF_COLORS' for slot 'Color'
The error message does not state whether or not it was not able to parse the provided LIST_OF_COLORS definition of if something else went wrong.
Is this a Amazon Alaxa bug or did I miss something there?
I got this error because I didn't actually create the custom type - I needed to click both the Add and the Add Slot Type button.
Step 1: Create your type and values.
Step 2: Commit your changes.
Found a solution:
The Add Button, from Custom Slot Types, did not work the first time I hit it, I tried it again, and the list changed into:
From there on, it has worked as described

PyCharm debugger doesn't show objects' content: "Unable to get repr for <type 'list>"

Debugging with PyCharm (happens on multiple versions) I'm unable to correctly view some lists and dictionaries (other are presented correctly).
In the view window the object's name is presented with the message:
{list} Unable to get repr for <type 'list>
or
{dict} Unable to get repr for <type 'dict'>
An update:
In one of my attempts, I received the following message from the debugger (presented instead of the value of one of the list variable):
Unable to display children:Error resolving variables Traceback (most
recent call last): File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line
1004, in do_it
_typeName, valDict = pydevd_vars.resolve_compound_variable(self.thread_id, self.frame_id,
self.scope, self.attributes) TypeError: 'NoneType' object is not
iterable
I'll appreciate any idea as for what may cause this behavior?
Thanks!
It turned out the problem is due to usage of rpyc.py: The process I was debugging was called through rpyc and while I was debugging it, the calling process received a timeout on the rpyc connection.
I think that this caused variables, passed through rpc to lose integrity so the debugger couldn't present them correctly.
The solution was to downgrade rpyc.py to version 3.3.0 (I was on 3.4.2).
My colleague, Nurit Izraelov, correctly suggested the rpyc.py version may be the blame.
Thanks all!
It happened to me sometimes and what caused the behaviour was that some MyClass triggered an exception on its str method.
In such a case, PyCharm debugger only showed
some_object = {MyClass} Unable to get repr for <class 'my_app.models.MyClass'>
So what I did to confirm the origin was to watch repr(some_object) in the Watches section of the debugger. And there it gave me an explicit error message:
{TypeError}%d format: a number is required, not NoneType
Which helped me trace back to the origin.
I appreciate this is not a generic answer, but just a complement to Fabio's.
Probably some custom class of yours has a bad __repr__ or __str__ in it and the debugger is unable to print it.
You can probably use a shell at that point to know which elements are actually inside such a dict or list (and see which object has the faulty __repr__ or __str__).
Extending the scope of the problem rather than adding an answer - all the other suggestions are what I do normally to get this working.
Could it be a race condition?
For me it appears to be something weird. In the Variables pane I can see correct representation for theObject, repr(theObject) and even [theObject] but if I set a variable in my code thus a = theObject or b = [theObject] then I get the "Unable to get repr for <class 'list'>" message.
theObject in this case is an instance of a subclassed D lang struct wrapped with autowrap.

kibana 4 gives an error "Discover: An error occurred with your request. Reset your inputs and try again"

kibana 4 gives an error "Discover: An error occurred with your request. Reset your inputs and try again" 80% of the time when I try to sort by a numeric field. It works fine when sorted by any other field. Did anyone get this issue?
I had this when I had added a sequence number in logstash to index (because several logs could be added in the same millisecond, causing the sort not to show the ordering correctly).
If you open up firefox debugger and view the console, it will show you more information related to the error. In my case
java.lang.Long cannot be cast to org.apache.lucene.util.BytesRef
I added
{ "unmapped_type": "number" }
into the advance settings - sort:options. It returns sorted data correctly but appears to throw a yellow warning.
Yes. I had that issue and opening the browser's javascript console helped me to see that a non-JSON document was the problem. Apparently, you can store non-JSON in elasticsearch (at least I can with 1.6.2). That creates problems with Kibana.
So: Open the browser's console, look for "error parsing body" or smth similar. You should also get the faulty string. Use that to identify to culprit document.

Why "Missing return statement" is not handled in languages?

Today I was getting introduced to Dart myself. At a point while playing with it, something was going wrong. Later I found that it was nothing but I forgot to put return statement in a function so null was set to the variable that was supposed to get value from that function.
At that point I was thinking, in Java it would be caught as error in the very first place. Why C/C++ or the new Dart don't add this feature? Does this feature slows the code down at a large scale? Or there are any other technical reasons behind this?
Every method returns a value, and if there is no return it is null.
However it looks like this some enhancements could be done in the future. See issue 73 : Missing return statement does not trigger warning or error and issue 13373 : Can get the editor to warn when there is no explicit return for a function returning a type.

three.js sparks.js

everytime I try to make a render with sparks.js and Three.js, i get the same error :
Uncaught TypeError: Property '_easing' of object [object Object] is not a function sparks.js:304
Could you please tell me more? I don't understand how to fix this. Thanks.
(The tag sparks.js doesn't exist so I couldn't include it, due to my reputation, sorry).
The error is caused by using an old TWEEN constant as default value for Age action.
Try to initialise Age explicitly like :
new SPARKS.Age(TWEEN.Easing.Linear.None)

Resources