Title: Always set error string before returning errors · Issue #1186 · arrayfire/arrayfire · GitHub
Open Graph Title: Always set error string before returning errors · Issue #1186 · arrayfire/arrayfire
X Title: Always set error string before returning errors · Issue #1186 · arrayfire/arrayfire
Description: The way to deal with this would be to have a macro something along the lines of AF_ERROR. Instead of throwing an exception, this just sets the error string and returns the error. Here are the culprits $ grep -ri throw src/api/cpp/ | grep...
Open Graph Description: The way to deal with this would be to have a macro something along the lines of AF_ERROR. Instead of throwing an exception, this just sets the error string and returns the error. Here are the culpr...
X Description: The way to deal with this would be to have a macro something along the lines of AF_ERROR. Instead of throwing an exception, this just sets the error string and returns the error. Here are the culpr...
Opengraph URL: https://github.com/arrayfire/arrayfire/issues/1186
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Always set error string before returning errors","articleBody":"The way to deal with this would be to have a macro something along the lines of `AF_ERROR`. Instead of throwing an exception, this just sets the error string and returns the error.\n\nHere are the culprits\n\n```\n $ grep -ri throw src/api/cpp/ | grep -v AF_THROW\nsrc/api/cpp/error.hpp: throw af::exception(__FILE__, __LINE__, __err); \\\nsrc/api/cpp/error.hpp: throw af::exception(__msg, __FILE__, __LINE__, __err); \\\nsrc/api/cpp/error.hpp:#define THROW(__err) throw af::exception(__FILE__, __LINE__, __err)\nsrc/api/cpp/exampleFunction.cpp: // is going to return and throw corresponding\nsrc/api/cpp/array.cpp: if (dim \u003e 3) THROW(AF_ERR_SIZE);\nsrc/api/cpp/array.cpp: // THOU SHALL NOT THROW IN DESTRUCTORS\nsrc/api/cpp/array.cpp: default: THROW(AF_ERR_SIZE);\n```\n\n```\n $ grep -r \"return AF_\" src/ | grep -v AF_SUCCESS\nsrc/backend/cpu/platform.cpp: return AF_BACKEND_CPU;\nsrc/backend/cuda/platform.cpp: return AF_BACKEND_CUDA;\nsrc/backend/opencl/platform.cpp: return AF_BACKEND_OPENCL;\nsrc/api/unified/symbol_manager.cpp: return AF_ERR_LOAD_LIB;\nsrc/api/unified/symbol_manager.cpp: return AF_ERR_LOAD_LIB;\nsrc/api/unified/symbol_manager.hpp: return AF_ERR_LOAD_LIB;\nsrc/api/unified/symbol_manager.hpp: return AF_ERR_LOAD_SYM;\nsrc/api/unified/symbol_manager.hpp: return AF_ERR_ARR_BKND_MISMATCH; \\\nsrc/api/c/colorspace.cpp: return AF_ERR_NOT_SUPPORTED;\nsrc/api/c/colorspace.cpp: default: return AF_ERR_ARG;\nsrc/api/c/colorspace.cpp: default: return AF_ERR_ARG;\nsrc/api/c/plot.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/plot.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/version.cpp: return AF_REVISION;\nsrc/api/c/plot3.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/plot3.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/hist.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/image.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/surface.cpp: return AF_ERR_NO_GFX;\nsrc/api/c/imageio.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio2.cpp: return AF_ERR_NOT_CONFIGURED;\nsrc/api/c/imageio2.cpp: return AF_ERR_NOT_CONFIGURED;\n```\n","author":{"url":"https://github.com/pavanky","@type":"Person","name":"pavanky"},"datePublished":"2015-12-28T21:16:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1186/arrayfire/issues/1186"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1be075c6-cb9e-9a77-2a4a-10f4371f4513 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF0E:225E33:BB22E0:FB2F09:69698415 |
| html-safe-nonce | 61a9a05e51be69b000774c3f6ae1c31b1f92f8a0f207cafa03374076b3fc3c22 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjBFOjIyNUUzMzpCQjIyRTA6RkIyRjA5OjY5Njk4NDE1IiwidmlzaXRvcl9pZCI6IjQyNzE1NzI4NDcxMzA0MTIwNTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 66389ece8934d3bf2f59a89f9e88b17c60d1c8bc7780e1b6ba34c3868cbbf6fb |
| hovercard-subject-tag | issue:124128476 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/arrayfire/arrayfire/1186/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6e0b3be7b42052c9c020fcb738a42d687b73866f23e624e1047d4285087bcf1/arrayfire/arrayfire/issues/1186 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6e0b3be7b42052c9c020fcb738a42d687b73866f23e624e1047d4285087bcf1/arrayfire/arrayfire/issues/1186 |
| og:image:alt | The way to deal with this would be to have a macro something along the lines of AF_ERROR. Instead of throwing an exception, this just sets the error string and returns the error. Here are the culpr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pavanky |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| go-import | github.com/arrayfire/arrayfire git https://github.com/arrayfire/arrayfire.git |
| octolytics-dimension-user_id | 5395442 |
| octolytics-dimension-user_login | arrayfire |
| octolytics-dimension-repository_id | 25889802 |
| octolytics-dimension-repository_nwo | arrayfire/arrayfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 25889802 |
| octolytics-dimension-repository_network_root_nwo | arrayfire/arrayfire |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width