Questions tagged [illegal-input]

3 questions
30
votes
5 answers

Equivalent of IllegalArgumentException of Java in C++

In Java if an input argument to a method is invalid, we can throw an IllegalArgumentException (which is of type RuntimeException). In C++, there is no notion of checked and unchecked exceptions. Is there a similar exception in standard C++ which can…
Srikanth
  • 11,780
  • 23
  • 72
  • 92
3
votes
5 answers

Should a method ignore illegal input or raise an exception?

If a method checks it's input and detects illegal input, what should it do: Raise an exception (or use another error-mechanism) or do nothing/ignoring on the wrong input? In Java the HashTable-class throws an NullPointerException if given…
Mnementh
  • 50,487
  • 48
  • 148
  • 202
0
votes
0 answers

io.ktor.serialization.JsonConvertException: Illegal input

I am trying to parse JSON in kotlin where I have a suspend function returning a list but it is giving an error io.ktor.serialization.JsonConvertException: Illegal input. The function is as follows private suspend fun fetchMenu(): List { …
M Baig
  • 55
  • 7