From 480530c4e3e88a5b51bbca24a167c85f8171864d Mon Sep 17 00:00:00 2001 From: Zhang Ting <709968123@qq.com> Date: Wed, 8 Apr 2020 11:06:47 +0800 Subject: [PATCH] API(place-related) error message enhancement (#23515) --- paddle/fluid/platform/place.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/platform/place.h b/paddle/fluid/platform/place.h index 4e7e157e3e2..eeda10a633b 100644 --- a/paddle/fluid/platform/place.h +++ b/paddle/fluid/platform/place.h @@ -119,7 +119,8 @@ struct PlaceVisitorWrapper #ifdef PADDLE_WITH_CUDA return visitor_(cuda); #else - PADDLE_THROW("Paddle is not compiled with CUDA. Cannot visit cuda device"); + PADDLE_THROW(platform::errors::Unavailable( + "Paddle is not compiled with CUDA. Cannot visit cuda device")); return typename Visitor::result_type(); #endif } @@ -129,7 +130,8 @@ struct PlaceVisitorWrapper #ifdef PADDLE_WITH_CUDA return visitor_(cuda_pinned); #else - PADDLE_THROW("Paddle is not compiled with CUDA. Cannot visit cuda_pinned"); + PADDLE_THROW(platform::errors::Unavailable( + "Paddle is not compiled with CUDA. Cannot visit cuda_pinned")); return typename Visitor::result_type(); #endif } -- GitLab