question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding strings should throw an error

See original GitHub issue

In CLI:

🦄 'a'+'b'

Expected: An error thrown.

Actual: Success

string ask(call(get('+'),'a','b'))
'0ab'
🦄 

The task is to throw an error, which says “You cannot add strings with +, please use concat() instead”, if at least one of the operands is a string. If #260 is closed already, add also “or template literals” to the error message.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
mhagmajercommented, Jun 27, 2020

@czerwinskilukasz1 yes, that’s also a type mismatch. Thanks!

0reactions
czerwinskilukasz1commented, Jul 1, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Throwing strings instead of Errors
While it is okay possible to throw any value, it is generally considered poor form to throw anything other than an instance of...
Read more >
TypeError: can only concatenate str (not "int") to str
This error occurs when you try adding (concatenating) an integer to a string. This error happens most commonly when trying to print an...
Read more >
How to Throw Exceptions in Java
Throwing an exception is as simple as using the "throw" statement. You then specify the Exception object you wish to throw. Every Exception...
Read more >
What to throw? Error or bare string dilemma
How throwing strings is better than throwing Errors. Statement throw can throw any type, not only Error s. Let's consider a sample code:...
Read more >
Excel CONCAT function - string concatenation examples
You will learn how to concatenate strings with space, comma, ... represented by another function that throws an error), an error will occur....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found