Add error handling for over sso seat limits

This commit is contained in:
Grant Limberg 2022-05-11 19:43:29 -07:00
parent 7e46c83592
commit aee9521c91
No known key found for this signature in database
GPG key ID: 8F2F97D3BE8D7735
4 changed files with 48 additions and 16 deletions

View file

@ -267,9 +267,19 @@ pub extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char
let code = unsafe{CStr::from_ptr(code)}.to_str().unwrap();
let ret = idc.do_token_exchange( code);
let ret = CString::new(ret).unwrap();
return ret.into_raw();
let ret = idc.do_token_exchange(code);
match ret {
Ok(ret) => {
let ret = CString::new(ret).unwrap();
return ret.into_raw();
},
Err(e) => {
let errstr = format!("{{\"message\":\"{}\"\"}}", e).to_string();
let ret = CString::new(errstr).unwrap();
return ret.into_raw();
}
}
}
#[no_mangle]
@ -338,4 +348,4 @@ pub extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
};
idc.kick_refresh_thread();
}
}