Skip to content

Commit 44e99e5

Browse files
authored
Merge pull request #107 from Kit/return-refresh-result
Return `refresh()` result
2 parents 588e3ed + 7efefe1 commit 44e99e5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/class-convertkit-resource-v4.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,12 @@ public function init() {
116116
// a last query time. This handles upgrades from < 1.9.7.4 where resources
117117
// would never expire.
118118
if ( ! $this->last_queried ) {
119-
$this->refresh();
120-
return;
119+
return $this->refresh();
121120
}
122121

123122
// If the resources have expired, refresh them now.
124123
if ( time() > ( $this->last_queried + $this->cache_duration ) ) {
125-
$this->refresh();
126-
return;
124+
return $this->refresh();
127125
}
128126

129127
}
@@ -344,13 +342,13 @@ public function exist() {
344342
*
345343
* @since 1.0.0
346344
*
347-
* @return bool|WP_Error|array
345+
* @return WP_Error|array
348346
*/
349347
public function refresh() {
350348

351349
// Bail if no API class was defined.
352350
if ( ! $this->api ) {
353-
return false;
351+
return new WP_Error( 'convertkit_resource_refresh_error', 'Connect the Plugin to your Kit account to refresh resources.' );
354352
}
355353

356354
// Fetch resources.

0 commit comments

Comments
 (0)