diff --git a/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.php b/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.php index c38f519..c5e392f 100644 --- a/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.php +++ b/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.php @@ -92,8 +92,15 @@ final class Chapter extends Watcher return true; } - // get API hash value - $hash = $this->chapters->sha($translation, $book, $chapter); + try + { + // get API hash value + $hash = $this->chapters->sha($translation, $book, $chapter); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -193,8 +200,15 @@ final class Chapter extends Watcher return true; } - // get all the books - $chapters = $this->chapters->list($translation, $book); + try + { + // get all the books + $chapters = $this->chapters->list($translation, $book); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($chapters->{$chapter}) || !isset($chapters->{$chapter}->sha)) @@ -232,8 +246,15 @@ final class Chapter extends Watcher // load all the verses from the local database $inserted = false; - // get verses from the API - if (($api = $this->chapters->list($translation, $book)) === null) + try + { + // get verses from the API + if (($api = $this->chapters->list($translation, $book)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } @@ -312,8 +333,15 @@ final class Chapter extends Watcher return true; } - // get all the verses - if (($verses = $this->verses->get($translation, $book, $chapter)) === null) + try + { + // get all the verses + if (($verses = $this->verses->get($translation, $book, $chapter)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } @@ -345,8 +373,15 @@ final class Chapter extends Watcher // load all the verses from the local database $inserted = false; - // get verses from the API - if (($api = $this->verses->get($translation, $book, $chapter)) === null) + try + { + // get verses from the API + if (($api = $this->verses->get($translation, $book, $chapter)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } diff --git a/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.power b/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.power index d578622..372f2fd 100644 --- a/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.power +++ b/src/07d3888a-5f35-4ba7-977f-fb2f5cf99061/code.power @@ -63,8 +63,15 @@ return true; } - // get API hash value - $hash = $this->chapters->sha($translation, $book, $chapter); + try + { + // get API hash value + $hash = $this->chapters->sha($translation, $book, $chapter); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -164,8 +171,15 @@ return true; } - // get all the books - $chapters = $this->chapters->list($translation, $book); + try + { + // get all the books + $chapters = $this->chapters->list($translation, $book); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($chapters->{$chapter}) || !isset($chapters->{$chapter}->sha)) @@ -203,8 +217,15 @@ // load all the verses from the local database $inserted = false; - // get verses from the API - if (($api = $this->chapters->list($translation, $book)) === null) + try + { + // get verses from the API + if (($api = $this->chapters->list($translation, $book)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } @@ -283,8 +304,15 @@ return true; } - // get all the verses - if (($verses = $this->verses->get($translation, $book, $chapter)) === null) + try + { + // get all the verses + if (($verses = $this->verses->get($translation, $book, $chapter)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } @@ -316,8 +344,15 @@ // load all the verses from the local database $inserted = false; - // get verses from the API - if (($api = $this->verses->get($translation, $book, $chapter)) === null) + try + { + // get verses from the API + if (($api = $this->verses->get($translation, $book, $chapter)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } diff --git a/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.php b/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.php index 1f81965..0aa1a5a 100644 --- a/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.php +++ b/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.php @@ -88,8 +88,15 @@ final class Translation extends Watcher return true; } - // get API hash value - $hash = $this->translations->sha($translation); + try + { + // get API hash value + $hash = $this->translations->sha($translation); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -122,8 +129,15 @@ final class Translation extends Watcher return true; } - // get all the translations - $translations = $this->translations->list(); + try + { + // get all the translations + $translations = $this->translations->list(); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($translations->{$translation}) || !isset($translations->{$translation}->sha)) @@ -150,8 +164,15 @@ final class Translation extends Watcher */ private function update(): bool { - // get translations from the API - if (($translations = $this->translations->list()) === null) + try + { + // get translations from the API + if (($translations = $this->translations->list()) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } diff --git a/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.power b/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.power index 4113175..25ea518 100644 --- a/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.power +++ b/src/7d592acd-f031-4d0f-b667-584c88ae0495/code.power @@ -60,8 +60,15 @@ return true; } - // get API hash value - $hash = $this->translations->sha($translation); + try + { + // get API hash value + $hash = $this->translations->sha($translation); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -94,8 +101,15 @@ return true; } - // get all the translations - $translations = $this->translations->list(); + try + { + // get all the translations + $translations = $this->translations->list(); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($translations->{$translation}) || !isset($translations->{$translation}->sha)) @@ -122,8 +136,15 @@ */ private function update(): bool { - // get translations from the API - if (($translations = $this->translations->list()) === null) + try + { + // get translations from the API + if (($translations = $this->translations->list()) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } diff --git a/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.php b/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.php index 0d9c1bc..77af22a 100644 --- a/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.php +++ b/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.php @@ -104,8 +104,15 @@ final class Book extends Watcher return true; } - // get API hash value - $hash = $this->books->sha($translation, $book); + try + { + // get API hash value + $hash = $this->books->sha($translation, $book); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -139,8 +146,15 @@ final class Book extends Watcher return true; } - // get all this translation books - $books = $this->books->list($translation); + try + { + // get all this translation books + $books = $this->books->list($translation); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($books->{$book}) || !isset($books->{$book}->sha)) @@ -169,8 +183,15 @@ final class Book extends Watcher */ private function update(string $translation): bool { - // get translations from the API - if (($books = $this->books->list($translation)) === null) + try + { + // get translations from the API + if (($books = $this->books->list($translation)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; } diff --git a/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.power b/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.power index df18e8d..1119401 100644 --- a/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.power +++ b/src/c2a8a5fa-8e7f-443a-86d7-a8c1e4cdfa98/code.power @@ -76,8 +76,15 @@ return true; } - // get API hash value - $hash = $this->books->sha($translation, $book); + try + { + // get API hash value + $hash = $this->books->sha($translation, $book); + } + catch (\Exception $e) + { + return false; + } // confirm hash has not changed if (hash_equals($hash, $this->target->sha)) @@ -111,8 +118,15 @@ return true; } - // get all this translation books - $books = $this->books->list($translation); + try + { + // get all this translation books + $books = $this->books->list($translation); + } + catch (\Exception $e) + { + return false; + } // check return data if (!isset($books->{$book}) || !isset($books->{$book}->sha)) @@ -141,8 +155,15 @@ */ private function update(string $translation): bool { - // get translations from the API - if (($books = $this->books->list($translation)) === null) + try + { + // get translations from the API + if (($books = $this->books->list($translation)) === null) + { + return false; + } + } + catch (\Exception $e) { return false; }