|  | 
| 10 | 10 | use Code16\OzuClient\OzuCms\OzuCollectionConfig; | 
| 11 | 11 | use Code16\OzuClient\OzuCms\List\OzuColumn; | 
| 12 | 12 | use Illuminate\Console\Command; | 
|  | 13 | +use Illuminate\Http\Client\RequestException; | 
| 13 | 14 | use Illuminate\Support\Facades\Schema; | 
| 14 | 15 | 
 | 
| 15 | 16 | class ConfigureCmsCommand extends Command | 
| @@ -41,6 +42,7 @@ public function handle(Client $ozuClient): int | 
| 41 | 42 |                     'label' => $collection->label(), | 
| 42 | 43 |                     'icon' => $collection->icon(), | 
| 43 | 44 |                     'hasPublicationState' => $collection->hasPublicationState(), | 
|  | 45 | +                    'autoDeployDateField' => $collection->autoDeployDateField(), | 
| 44 | 46 |                     'isCreatable' => $collection->isCreatable(), | 
| 45 | 47 |                     'isDeletable' => $collection->isDeletable(), | 
| 46 | 48 |                     'order' => $k+1, | 
| @@ -83,10 +85,21 @@ public function handle(Client $ozuClient): int | 
| 83 | 85 |             }) | 
| 84 | 86 |             ->each(function (array $collection) use ($ozuClient) { | 
| 85 | 87 |                 $this->info('Update CMS configuration for [' . $collection['key'] . '].'); | 
| 86 |  | -                $ozuClient->updateCollectionSharpConfiguration( | 
| 87 |  | -                    $collection['key'], | 
| 88 |  | -                    $collection | 
| 89 |  | -                ); | 
|  | 88 | +                try{ | 
|  | 89 | +                    $ozuClient->updateCollectionSharpConfiguration( | 
|  | 90 | +                        $collection['key'], | 
|  | 91 | +                        $collection | 
|  | 92 | +                    ); | 
|  | 93 | +                } catch(RequestException $e) { | 
|  | 94 | +                    if ($message = $e->response->json()) { | 
|  | 95 | +                        if(!isset($message['message'])) { | 
|  | 96 | +                            throw $e; | 
|  | 97 | +                        } | 
|  | 98 | +                        $this->error('[' . $collection['key'] . '] '.$message['message']); | 
|  | 99 | +                    } else { | 
|  | 100 | +                        throw $e; | 
|  | 101 | +                    } | 
|  | 102 | +                } | 
| 90 | 103 |             }); | 
| 91 | 104 | 
 | 
| 92 | 105 |         $this->info('CMS configuration sent to Ozu.'); | 
|  | 
0 commit comments