Skip to content

quandl/raven-lua

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raven-lua

A small Lua interface to Sentry that also has a helpful wrapper function call() that takes any arbitrary Lua function (with arguments) and executes it, traps any errors and reports it automatically to Sentry.

Updates from Original

The original library from Cloudflare has not been updated since January 2015. There were some bugs that were caught by users, and pull requests made to fix those bugs. Those updates were merged into this forked copy of the original repo.

  1. Fixes https connections: PR #4 by mattrobenolt
  2. Fixes invalid value tags for parameters: PR #13 by ye

Synopsis

local raven = require 'raven'

-- http://pub:[email protected]:8080/sentry/proj-id
local rvn = raven:new("http://pub:[email protected]:8080/sentry/proj-id", {
   tags = { foo = "bar" },
})

-- Send a message to sentry
local id, err = rvn:captureMessage(
  "Sentry is a realtime event logging and aggregation platform.",
  { tags = { abc = "def" } } -- optional
)
if not id then
   print(err)
end

-- Send an exception to sentry
local exception = {{
   ["type"]= "SyntaxError",
   ["value"]= "Wattttt!",
   ["module"]= "__builtins__"
}}
local id, err = rvn:captureException(
   exception,
   { tags = { abc = "def" } } -- optional
)
if not id then
   print(err)
end

-- Catch an exception and send it to sentry
function bad_func(n)
   return not_defined_func(n)
end

-- variable 'ok' should be false, and an exception will be sent to sentry
local ok = rvn:call(bad_func, 1)

Documents

See docs/index.html for more details.

Prerequisites

# for unit tests
$luarocks install lunit
$luarocks install luaposix

# for generating docs
$luarocks install ldoc

Releases

No releases published

Packages

No packages published

Languages

  • Lua 98.4%
  • Makefile 1.6%