Use precondition instead of raising an exception.
Fixed bug#14062: CURL dynamic library not found exception is causing an internal failure in WEL git-svn-id: https://svn.origo.ethz.ch/eiffelstudio/trunk/Src/library/cURL@72612 8089f293-4706-0410-a29e-feb5c42a2edf
This commit is contained in:
@@ -1,40 +0,0 @@
|
|||||||
indexing
|
|
||||||
description: "[
|
|
||||||
Exception which means cURL dynamic library (*.dll on Windows,
|
|
||||||
*.so on Linux and ...) not found.
|
|
||||||
]"
|
|
||||||
status: "See notice at end of class."
|
|
||||||
legal: "See notice at end of class."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
CURL_DYNAMIC_LIBRARY_NOT_FOUND_EXCEPTION
|
|
||||||
|
|
||||||
inherit
|
|
||||||
DEVELOPER_EXCEPTION
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make is
|
|
||||||
-- Creation method.
|
|
||||||
do
|
|
||||||
set_message ("cURL dynamic library not found.")
|
|
||||||
end
|
|
||||||
|
|
||||||
indexing
|
|
||||||
library: "cURL: Library of reusable components for Eiffel."
|
|
||||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
|
||||||
source: "[
|
|
||||||
Eiffel Software
|
|
||||||
356 Storke Road, Goleta, CA 93117 USA
|
|
||||||
Telephone 805-685-1006, Fax 805-685-6869
|
|
||||||
Website http://www.eiffel.com
|
|
||||||
Customer support http://support.eiffel.com
|
|
||||||
]"
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -16,16 +16,14 @@ feature -- Command
|
|||||||
|
|
||||||
init: POINTER is
|
init: POINTER is
|
||||||
-- Declared as curl_easy_init().
|
-- Declared as curl_easy_init().
|
||||||
|
require
|
||||||
|
dynamic_library_exists: is_dynamic_library_exists
|
||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
l_exception: CURL_DYNAMIC_LIBRARY_NOT_FOUND_EXCEPTION
|
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_init")
|
l_api := api_loader.safe_load_api (module_name, "curl_easy_init")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
Result := c_init (l_api)
|
Result := c_init (l_api)
|
||||||
else
|
|
||||||
create l_exception.make
|
|
||||||
l_exception.raise
|
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
exists: Result /= default_pointer
|
exists: Result /= default_pointer
|
||||||
@@ -126,6 +124,14 @@ feature -- Command
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Query
|
||||||
|
|
||||||
|
is_dynamic_library_exists: BOOLEAN is
|
||||||
|
-- If dll/so files exist?
|
||||||
|
do
|
||||||
|
Result := (api_loader.module_pointer (module_name) /= default_pointer)
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Special setting
|
feature -- Special setting
|
||||||
|
|
||||||
set_curl_function (a_curl_function: CURL_FUNCTION) is
|
set_curl_function (a_curl_function: CURL_FUNCTION) is
|
||||||
|
|||||||
@@ -16,16 +16,14 @@ feature -- Command
|
|||||||
|
|
||||||
global_init is
|
global_init is
|
||||||
-- Declared as curl_global_init().
|
-- Declared as curl_global_init().
|
||||||
|
require
|
||||||
|
dynamic_library_exists: is_dynamic_library_exists
|
||||||
local
|
local
|
||||||
l_ptr: POINTER
|
l_ptr: POINTER
|
||||||
l_exception: CURL_DYNAMIC_LIBRARY_NOT_FOUND_EXCEPTION
|
|
||||||
do
|
do
|
||||||
l_ptr := api_loader.safe_load_api (module_name, "curl_global_init")
|
l_ptr := api_loader.safe_load_api (module_name, "curl_global_init")
|
||||||
if l_ptr /= default_pointer then
|
if l_ptr /= default_pointer then
|
||||||
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
||||||
else
|
|
||||||
create l_exception.make
|
|
||||||
l_exception.raise
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user