From 3ebb065509aa027088bd1a6ea3d4ee005f4d45fe Mon Sep 17 00:00:00 2001 From: v1ne Date: Fri, 26 Jul 2019 00:20:53 +0200 Subject: [PATCH] Clean up: Use "enforce" --- source/vibe/core/file.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/vibe/core/file.d b/source/vibe/core/file.d index e32efef..4bd1cda 100644 --- a/source/vibe/core/file.d +++ b/source/vibe/core/file.d @@ -647,8 +647,7 @@ struct DirectoryWatcher { // TODO: avoid all those heap allocations! m_context = new Context; // FIME: avoid GC allocation (use FD user data slot) m_context.changeEvent = createManualEvent(); m_watcher = eventDriver.watchers.watchDirectory(path.toNativeString, recursive, &m_context.onChange); - if (m_watcher == WatcherID.invalid) - throw new Exception("Failed to watch directory."); + enforce(m_watcher != WatcherID.invalid, "Failed to watch directory."); m_context.path = path; m_context.recursive = recursive; m_context.changes = appender!(DirectoryChange[]);