1 | -- resty-gitweb@git/git2_error.lua |
2 | -- Error handling for libgit2 |
3 |
|
4 | -- Copyright (c) 2020 Joshua 'joshuas3' Stockin |
5 | -- <https://git.joshstock.in/resty-gitweb> |
6 | -- This software is licensed under the MIT License. |
7 |
|
8 | local ffi = require("ffi") |
9 |
|
10 | local _M = function(err, message) |
11 | if err < 0 then |
12 | local git2_error_message = ffi.string(git2.git_error_last().message) |
13 | error(string.format("<pre>libgit2 Error - %s (\"%s\")\n%s</pre>", message, git2_error_message, debug.traceback())) |
14 | end |
15 | end |
16 |
|
17 | return _M |
18 |
|