Merge pull request #444 from gradido/login_crash_fix

Login crash fix
This commit is contained in:
einhornimmond 2021-05-14 17:04:26 +02:00 committed by GitHub
commit 52b465ef6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 22 deletions

View File

@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [1.0.0](https://github.com/gradido/gradido/compare/0.9.4...1.0.0)
#### [1.0.1](https://github.com/gradido/gradido/compare/1.0.0...1.0.1)
- add try catch blocks to prevent login-server from crashing [`22ff220`](https://github.com/gradido/gradido/commit/22ff22072956f8b843037c75c5b16b7ff5d6a2a3)
- fix [`14a4243`](https://github.com/gradido/gradido/commit/14a424347817b1fe6912a113bffd70e55d688112)
### [1.0.0](https://github.com/gradido/gradido/compare/0.9.4...1.0.0)
> 14 May 2021
- Login build alpine [`#423`](https://github.com/gradido/gradido/pull/423)
- Release fix [`#428`](https://github.com/gradido/gradido/pull/428)
- Send button only click [`#427`](https://github.com/gradido/gradido/pull/427)
- use new function for balance overview in old frontend, update balance… [`#422`](https://github.com/gradido/gradido/pull/422)

View File

@ -1,6 +1,6 @@
{
"name": "bootstrap-vue-gradido-wallet",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"scripts": {
"start": "node run/server.js",

View File

@ -85,12 +85,13 @@ Poco::JSON::Object* JsonCreateTransaction::handle(Poco::Dynamic::Var params)
Poco::JSON::Object* JsonCreateTransaction::transfer(Poco::Dynamic::Var params)
{
static const char* function_name = "JsonCreateTransaction::transfer";
auto target_pubkey = getTargetPubkey(params);
if (!target_pubkey) {
return customStateError("not found", "receiver not found");
}
auto user = mSession->getNewUser();
auto sender_user = mSession->getNewUser();
Poco::UInt32 amount = 0;
auto mm = MemoryManager::getInstance();
Poco::JSON::Object* result = nullptr;
@ -121,25 +122,44 @@ Poco::JSON::Object* JsonCreateTransaction::transfer(Poco::Dynamic::Var params)
result = stateError("user not in group", "receiver user isn't in target group");
}
}
auto sender_user = mSession->getNewUser();
if (sender_user->getGradidoKeyPair()->isTheSame(*target_pubkey)) {
result = stateError("sender and receiver are the same");
auto gradido_key_pair = sender_user->getGradidoKeyPair();
if (gradido_key_pair) {
if (gradido_key_pair->isTheSame(*target_pubkey)) {
result = stateError("sender and receiver are the same");
}
}
else {
printf("user hasn't valid key pair set\n");
}
if (!result) {
auto transaction = model::gradido::Transaction::createTransfer(sender_user, target_pubkey, mTargetGroup, amount, mMemo, mBlockchainType);
try {
auto transaction = model::gradido::Transaction::createTransfer(sender_user, target_pubkey, mTargetGroup, amount, mMemo, mBlockchainType);
if (mAutoSign) {
Poco::JSON::Array errors;
transaction->sign(user);
if (transaction->errorCount() > 0) {
errors.add(transaction->getErrorsArray());
}
if (mAutoSign) {
Poco::JSON::Array errors;
transaction->sign(sender_user);
if (transaction->errorCount() > 0) {
errors.add(transaction->getErrorsArray());
}
if (errors.size() > 0) {
return stateError("error by signing transaction", errors);
if (errors.size() > 0) {
return stateError("error by signing transaction", errors);
}
}
}
catch (Poco::Exception& ex) {
NotificationList errors;
errors.addError(new ParamError(function_name, "poco exception: ", ex.displayText()));
errors.sendErrorsAsEmail();
return stateError("exception");
}
catch (std::exception& ex) {
NotificationList errors;
errors.addError(new ParamError(function_name, "std::exception: ", ex.what()));
errors.sendErrorsAsEmail();
return stateError("exception");
}
result = stateSuccess();
}
mm->releaseMemory(target_pubkey);
@ -147,6 +167,7 @@ Poco::JSON::Object* JsonCreateTransaction::transfer(Poco::Dynamic::Var params)
}
Poco::JSON::Object* JsonCreateTransaction::creation(Poco::Dynamic::Var params)
{
static const char* function_name = "JsonCreateTransaction::creation";
auto target_pubkey = getTargetPubkey(params);
if (!target_pubkey) {
return customStateError("not found", "receiver not found");
@ -205,11 +226,25 @@ Poco::JSON::Object* JsonCreateTransaction::creation(Poco::Dynamic::Var params)
}
if(!result) {
auto transaction = model::gradido::Transaction::createCreation(mReceiverUser, amount, target_date, mMemo, mBlockchainType);
if (mAutoSign) {
if (!transaction->sign(mSession->getNewUser())) {
return stateError("error by signing transaction", transaction);
try {
auto transaction = model::gradido::Transaction::createCreation(mReceiverUser, amount, target_date, mMemo, mBlockchainType);
if (mAutoSign) {
if (!transaction->sign(mSession->getNewUser())) {
return stateError("error by signing transaction", transaction);
}
}
}
catch (Poco::Exception& ex) {
NotificationList errors;
errors.addError(new ParamError(function_name, "poco exception: ", ex.displayText()));
errors.sendErrorsAsEmail();
return stateError("exception");
}
catch (std::exception& ex) {
NotificationList errors;
errors.addError(new ParamError(function_name, "std::exception: ", ex.what()));
errors.sendErrorsAsEmail();
return stateError("exception");
}
result = stateSuccess();

View File

@ -32,6 +32,8 @@ namespace UniLib {
int CPUShedulerThread::ThreadFunction()
{
Poco::Logger& errorLog = Poco::Logger::get("errorLog");
static const char* function_name = "CPUShedulerThread::ThreadFunction";
while(!mWaitingTask.isNull())
{
@ -53,7 +55,15 @@ namespace UniLib {
#endif
}
catch (Poco::NullPointerException& ex) {
printf("[CPUShedulerThread::ThreadFunction] Null Pointer Exception for Task type: %s\n", mWaitingTask->getResourceType());
//printf("[CPUShedulerThread::ThreadFunction] Null Pointer Exception for Task type: %s\n", mWaitingTask->getResourceType());
errorLog.error("[%s] Null Pointer Exception for Task type %s: %s", function_name, mWaitingTask->getResourceType(), ex.displayText());
}
catch (Poco::Exception& ex) {
errorLog.error("[%s] Exception for Task type %s: %s", function_name, mWaitingTask->getResourceType(), ex.displayText());
}
catch (std::exception& ex) {
std::string exception_message = ex.what();
errorLog.error("[%s] std::exception for task type %s: %s", function_name, mWaitingTask->getResourceType(), exception_message);
}
mWaitingTask = mParent->getNextUndoneTask(this);

View File

@ -1,6 +1,6 @@
{
"name": "gradido",
"version": "1.0.0",
"version": "1.0.1",
"description": "Gradido",
"main": "index.js",
"repository": "git@github.com:gradido/gradido.git",