You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
version of lnd: lnd version 0.9.0-beta commit=v0.9.0-beta-rc1
which operating system (uname -a on *Nix): Linux thomas-ThinkPad-T480 4.15.0-91-generic Some minor fixes #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
version of btcd, bitcoind, or other backend: irrelevant for this issue
Steps to reproduce
Start up a new instance of lnd
Make up an invoice hash
Try to request it through the REST API
Expected behaviour
The API should return a 404, signaling that the invoice does not exist.
Actual behaviour
Lnd returns a 500 Internal Server Error:
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Trailer: Grpc-Trailer-Content-Type
Date: Tue, 31 Mar 2020 23:58:42 GMT
Transfer-Encoding: chunked
{
"error": "there are no existing invoices",
"message": "there are no existing invoices",
"code": 2
}
Background
I am using the REST API to retrieve the state of an invoice:
Your environment
version of
lnd: lnd version 0.9.0-beta commit=v0.9.0-beta-rc1which operating system (
uname -aon *Nix): Linux thomas-ThinkPad-T480 4.15.0-91-generic Some minor fixes #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linuxversion of
btcd,bitcoind, or other backend: irrelevant for this issueSteps to reproduce
Expected behaviour
The API should return a 404, signaling that the invoice does not exist.
Actual behaviour
Lnd returns a 500 Internal Server Error:
According to the HTTP spec, status code 500 is to be used for:
I would argue that a non-existent invoice is certainly not unexpected and hence status code 500 is inappropriate here.