Browse Source

Don't log long stacktraces.

pull/48/head
James Cole 4 years ago
parent
commit
2d74f9c88b
No known key found for this signature in database GPG Key ID: BDE6667570EADBD5
  1. 4
      app/Http/Controllers/TokenController.php
  2. 8
      app/Services/CSV/Conversion/Routine/CSVFileProcessor.php
  3. 2
      app/Services/CSV/Conversion/Routine/LineProcessor.php
  4. 2
      app/Services/CSV/Mapper/Bills.php
  5. 2
      app/Services/CSV/Mapper/Budgets.php
  6. 2
      app/Services/CSV/Mapper/Categories.php
  7. 6
      app/Services/CSV/Mapper/GetAccounts.php
  8. 2
      app/Services/CSV/Mapper/MapperService.php
  9. 2
      app/Services/CSV/Mapper/TransactionCurrencies.php
  10. 4
      app/Services/Nordigen/Request/Request.php
  11. 6
      app/Services/Shared/Import/Routine/ApiSubmitter.php
  12. 4
      app/Services/Spectre/Request/Request.php

4
app/Http/Controllers/TokenController.php

@ -100,7 +100,7 @@ class TokenController extends Controller
$body = (string) $e->getResponse()->getBody();
app('log')->error(sprintf('Client exception when decoding response: %s', $e->getMessage()));
app('log')->error(sprintf('Response from server: "%s"', $body));
app('log')->error($e->getTraceAsString());
//app('log')->error($e->getTraceAsString());
}
return view('error')->with('message', $e->getMessage())->with('body', $body);
@ -111,7 +111,7 @@ class TokenController extends Controller
} catch (JsonException $e) {
app('log')->error(sprintf('JSON exception when decoding response: %s', $e->getMessage()));
app('log')->error(sprintf('Response from server: "%s"', (string) $response->getBody()));
app('log')->error($e->getTraceAsString());
//app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('JSON exception when decoding response: %s', $e->getMessage()));
}
app('log')->debug('Response', $data);

8
app/Services/CSV/Conversion/Routine/CSVFileProcessor.php

@ -85,7 +85,7 @@ class CSVFileProcessor
$this->reader->setDelimiter($this->delimiter);
} catch (Exception $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
//app('log')->error($e->getTraceAsString());
$message = sprintf('Could not set delimiter: %s', $e->getMessage());
$this->addError(0, $message);
return [];
@ -96,7 +96,7 @@ class CSVFileProcessor
$records = $stmt->process($this->reader);
} catch (Exception $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
$message = sprintf('Could not read CSV: %s', $e->getMessage());
$this->addError(0, $message);
return [];
@ -106,7 +106,7 @@ class CSVFileProcessor
return $this->processCSVLines($records);
} catch (ImporterErrorException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
$message = sprintf('Could not parse CSV: %s', $e->getMessage());
$this->addError(0, $message);
return [];
@ -179,7 +179,7 @@ class CSVFileProcessor
$hash = hash('sha256', json_encode($line, JSON_THROW_ON_ERROR));
} catch (JsonException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not decode JSON line #%d: %s', $index, $e->getMessage()));
}
if (in_array($hash, $hashes, true)) {

2
app/Services/CSV/Conversion/Routine/LineProcessor.php

@ -80,7 +80,7 @@ class LineProcessor
$processed[] = $this->process($line);
} catch (ImporterErrorException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
$this->addError(0, $e->getMessage());
}
}

2
app/Services/CSV/Mapper/Bills.php

@ -55,7 +55,7 @@ class Bills implements MapperInterface
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download bills: %s', $e->getMessage()));
}
/** @var Bill $bill */

2
app/Services/CSV/Mapper/Budgets.php

@ -56,7 +56,7 @@ class Budgets implements MapperInterface
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download budgets: %s', $e->getMessage()));
}

2
app/Services/CSV/Mapper/Categories.php

@ -56,7 +56,7 @@ class Categories implements MapperInterface
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download categories: %s', $e->getMessage()));
}
/** @var Category $category */

6
app/Services/CSV/Mapper/GetAccounts.php

@ -60,7 +60,7 @@ trait GetAccounts
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download accounts: %s', $e->getMessage()));
}
@ -114,7 +114,7 @@ trait GetAccounts
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download asset accounts: %s', $e->getMessage()));
}
@ -137,7 +137,7 @@ trait GetAccounts
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download liability accounts: %s', $e->getMessage()));
}

2
app/Services/CSV/Mapper/MapperService.php

@ -59,7 +59,7 @@ class MapperService
$reader->setDelimiter($delimiter);
} catch (Exception $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not set delimiter: %s', $e->getMessage()));
}

2
app/Services/CSV/Mapper/TransactionCurrencies.php

@ -56,7 +56,7 @@ class TransactionCurrencies implements MapperInterface
$response = $request->get();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
throw new ImporterErrorException(sprintf('Could not download currencies: %s', $e->getMessage()));
}
/** @var TransactionCurrency $currency */

4
app/Services/Nordigen/Request/Request.php

@ -140,7 +140,7 @@ abstract class Request
}
if (null !== $res && 200 !== $res->getStatusCode()) {
// return body, class must handle this
app('log')->error(sprintf('Status code is %d', $res->getStatusCode()));
app('log')->error(sprintf('[1] Status code is %d', $res->getStatusCode()));
$body = (string) $res->getBody();
}
@ -161,7 +161,7 @@ abstract class Request
}
if (null === $json) {
throw new ImporterHttpException(sprintf('Body is empty. Status code is %d.', $res->getStatusCode()));
throw new ImporterHttpException(sprintf('Body is empty. [2] Status code is %d.', $res->getStatusCode()));
}
app('log')->debug('Return JSON result of authenticatedGet');

6
app/Services/Shared/Import/Routine/ApiSubmitter.php

@ -123,7 +123,7 @@ class ApiSubmitter
} catch (ApiHttpException $e) {
$message = sprintf('Could not create tag. %s', $e->getMessage());
app('log')->error($message);
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
$this->addError(0, $message);
return;
@ -245,7 +245,7 @@ class ApiSubmitter
$response = $request->post();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
//app('log')->error($e->getTraceAsString());
$message = sprintf('Submission HTTP error: %s', $e->getMessage());
$this->addError($index, $message);
@ -448,7 +448,7 @@ class ApiSubmitter
$request->put();
} catch (ApiHttpException $e) {
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
// app('log')->error($e->getTraceAsString());
$this->addError(0, 'Could not store transaction: see the log files.');
}
}

4
app/Services/Spectre/Request/Request.php

@ -141,7 +141,7 @@ abstract class Request
}
if (null !== $res && 200 !== $res->getStatusCode()) {
// return body, class must handle this
app('log')->error(sprintf('Status code is %d', $res->getStatusCode()));
app('log')->error(sprintf('[3] Status code is %d', $res->getStatusCode()));
$body = (string) $res->getBody();
}
@ -162,7 +162,7 @@ abstract class Request
}
if (null === $json) {
throw new ImporterHttpException(sprintf('Body is empty. Status code is %d.', $res->getStatusCode()));
throw new ImporterHttpException(sprintf('Body is empty. [4] Status code is %d.', $res->getStatusCode()));
}
return $json;

Loading…
Cancel
Save