Status code 404 returned when retrieving non existent branch (issue #2922)

Accessing a repository branch that does not exist returns a 404 error instead
of 200 now. Added a test.
Changed function to `not_found`.

Instead of using funtion `error!` the function `not_found!` is used to return 404 error. Adjusted documentation accordingly.
Merge pull request #2946 from Asquera/fix/access_to_non_existent_branch

API: Fixes return code when accessing non existent branch (#2922)