This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_failing_function(exception, function_name, filename): | |
code = compile('def f(): raise exception', filename, 'exec') | |
namespace = {'exception': exception} | |
eval(code, namespace) | |
code = namespace['f'].__code__ | |
CodeType = type(code) | |
namespace['f'].__code__ = CodeType( | |
code.co_argcount, | |
code.co_nlocals, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ip": "192.168.1.1", | |
"message": "Hello [email protected]. You signed up with card 1234-1234-1234-1234. Your home folder is C:\\Users\\peter. Look at our compliance from 127.0.0.1", | |
"extra": { | |
"foo": 42, | |
"bar": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"event_id": "cdbe646b-de0e-4f85-bdc5-2703bc517bdf" | |
} | |
-> | |
Event { | |
id: Annotated { | |
value: Maybe::Valid(Uuid("cdbe646b-de0e-4f85-bdc5-2703bc517bdf")), | |
metadata: MetaData { errors: vec![] }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn add_scope_processor<F, B>(&mut self, f: F) | |
where | |
F: Fn(&mut Event) + Sync + Send, | |
Box<F>: im::shared::Shared<Box<Fn(&mut Event) + Sync + Send>>, | |
{ | |
self.scope_processors = self.scope_processors.push_back(Box::new(f)); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn add_scope_processor<F>(&mut self, f: Box<F>) | |
where | |
F: Fn(&mut Event) + Sync + Send + ?Sized, | |
Box<F>: im::shared::Shared<Box<Fn(&mut Event) + Sync + Send>>, | |
{ | |
self.scope_processors = self.scope_processors.push_back(f); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone)] | |
pub struct Scope { | |
pub(crate) fingerprint: Option<Arc<Vec<Cow<'static, str>>>>, | |
pub(crate) transaction: Option<Arc<String>>, | |
pub(crate) breadcrumbs: im::Vector<Breadcrumb>, | |
pub(crate) user: Option<Arc<User>>, | |
pub(crate) extra: im::HashMap<String, Value>, | |
pub(crate) tags: im::HashMap<String, String>, | |
pub(crate) contexts: im::HashMap<String, Option<Context>>, | |
pub(crate) scope_processors: im::Vector<Box<FnMut(&mut Event) + Sync + Send>>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt::Debug; | |
trait Foo: Debug + 'static { | |
// either remove this method | |
fn debug(&self) -> String where Self: Sized { | |
format!("{:?}", self) | |
} | |
} | |
impl Foo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Helper trait to downcast a response error into a fail. | |
pub trait ResponseErrorAsFail { | |
/// Returns the response error as fail. | |
fn as_fail(&self) -> &Fail; | |
/// Returns the response error as mut fail. | |
fn as_mut_fail(&mut self) -> &mut Fail; | |
} | |
#[doc(hidden)] | |
impl<T: ResponseError> ResponseErrorAsFail for T { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sentry-cli-Darwin-x86_64`thread_local::thread_id::get::hc2a84d0e0859fd2f: | |
-> 0x1005d384b <+123>: movdqa (%rax), %xmm0 | |
0x1005d384f <+127>: movq $0x1, (%rax) | |
0x1005d3856 <+134>: movq %rcx, 0x8(%rax) | |
0x1005d385a <+138>: movdqa %xmm0, -0x20(%rbp) | |
Target 0: (sentry-cli-Darwin-x86_64) stopped. | |
(lldb) bt | |
* thread #2, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) | |
* frame #0: 0x00000001005d384b sentry-cli-Darwin-x86_64`thread_local::thread_id::get::hc2a84d0e0859fd2f + 123 | |
frame #1: 0x00000001005763d6 sentry-cli-Darwin-x86_64`regex::re_unicode::Regex::captures::hd2ce31a6cd7fdbc7 + 70 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::mem; | |
use std::ptr; | |
use std::sync::Arc; | |
use std::collections::HashMap; | |
fn main() { | |
let mut hm = HashMap::new(); | |
let key = (Arc::new("1".to_string()), Arc::new("2".to_string())); | |
let data = vec![key.0.clone(), key.1.clone()]; |