Add error messsage for large integer literals

Summary:
Fixing https://app.asana.com/0/170237629387822/481366792497820/f

Test plan:
Started two builds, one with the fix and the second one without the fix.
Connected to each of them using `neo4j` client.

Logs received from the build wihtout the fix:
```
neo4j> Create (n: BigInteger{id:12345678912345678912345}) return n;
<interactive>:0:0: error:
```
```
I1120 13:29:09.551208 30482 executing.hpp:69] [Run] 'Create (n: BigInteger{id:12345678912345678912345}) return n'
W1120 13:29:09.552387 30482 executing.hpp:145] Error message:
```

Logs received from the build with the fix:
```
neo4j> Create (n: BigInteger{id:12345678912345678912345}) return n;
<interactive>:0:0: error: Integer literal exceeds 64 bits
```
```
I1120 13:29:07.940943 30453 executing.hpp:69] [Run] 'Create (n: BigInteger{id:12345678912345678912345}) return n'
W1120 13:29:07.942919 30453 executing.hpp:146] Error message: Integer literal exceeds 64 bits
```

Reviewers: mislav.bradac, teon.banek

Reviewed By: mislav.bradac

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D997
This commit is contained in:
Matija Santl 2017-11-20 13:33:16 +01:00
parent 3c9e143c95
commit df4cbdc5b2

View File

@ -17,7 +17,7 @@ int64_t ParseIntegerLiteral(const std::string &s) {
// Not really correct since long long can have a bigger range than int64_t.
return static_cast<int64_t>(std::stoll(s, 0, 0));
} catch (const std::out_of_range &) {
throw SemanticException();
throw SemanticException("Integer literal exceeds 64 bits");
}
}