Skip to content

Commit 2623767

Browse files
authored
log warning if failed to read or write to local cache (#124)
* log warning if failed to read or write to local cache * bump up version
1 parent 46afe7e commit 2623767

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.6.11
4+
5+
* Log warnings if failed to read or write to the local access token cache.
6+
37
## v0.6.10
48

59
* Fix for `ImportError: cannot import name 'appengine' from 'urllib3.contrib'`

railib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version_info__ = (0, 6, 10)
15+
__version_info__ = (0, 6, 11)
1616
__version__ = ".".join(map(str, __version_info__))

railib/rest.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def _read_cache() -> dict:
126126
try:
127127
with open(_cache_file(), 'r') as cache:
128128
return json.loads(cache.read())
129-
except Exception:
129+
except Exception as e:
130+
logger.warning(f'Failed to read token cache {_cache_file()}: {e}')
130131
return {}
131132

132133

@@ -147,8 +148,8 @@ def _write_token_cache(creds: ClientCredentials):
147148

148149
with open(_cache_file(), 'w') as f:
149150
f.write(json.dumps(cache, default=vars))
150-
except Exception:
151-
pass
151+
except Exception as e:
152+
logger.warning(f'Failed to write to token cache {_cache_file()}: {e}')
152153

153154

154155
# Returns the current access token if valid, otherwise requests new token.

0 commit comments

Comments
 (0)