{"id":2403,"date":"2026-09-06T23:48:05","date_gmt":"2026-09-06T23:48:05","guid":{"rendered":"https:\/\/wayhope.kro.kr\/?p=2403"},"modified":"2026-09-06T23:48:05","modified_gmt":"2026-09-06T23:48:05","slug":"error-throw-%ec%8b%a4%eb%ac%b4-%ec%82%ac%ec%9a%a9-%eb%b0%a9%eb%b2%95","status":"publish","type":"post","link":"https:\/\/wayhope.kro.kr\/?p=2403","title":{"rendered":"Error Throw \uc2e4\ubb34 \uc0ac\uc6a9 \ubc29\ubc95"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><code>throw<\/code>\ub294 \ud504\ub85c\uadf8\ub7a8 \uc2e4\ud589 \uc911 \ubc1c\uc0dd\ud55c <strong>\uc608\uc678 \uc0c1\ud669\uc744 \ud638\ucd9c\uc790\uc5d0\uac8c \uc804\ub2ec\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ud558\ub294 \ubb38\ubc95<\/strong>\uc774\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc2e4\ubb34\uc5d0\uc11c\ub294 \ub2e8\uc21c\ud788 \uc5d0\ub7ec \uba54\uc2dc\uc9c0\ub97c \ucd9c\ub825\ud558\ub294 \uc6a9\ub3c4\ub85c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294\ub2e4.<br>\uc8fc\ub85c <strong>\ud604\uc7ac \ud568\uc218\uac00 \uc815\uc0c1\uc801\uc778 \uacb0\uacfc\ub97c \ubc18\ud658\ud560 \uc218 \uc5c6\ub294 \uc0c1\ud669\uc744 \uba85\ud655\ud558\uac8c \uc54c\ub9ac\uace0, \uc0c1\uc704 \uacc4\uce35\uc5d0\uc11c \uc608\uc678\ub97c \ucc98\ub9ac\ud558\ub3c4\ub85d \ub9cc\ub4dc\ub294 \uc5ed\ud560<\/strong>\ub85c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\uae30\ubcf8 \uc0ac\uc6a9\ubc95<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetUser(id: number) {\n    if (id &lt;= 0) {\n        throw new Error(\"Invalid user id\");\n    }\n\n    return FindUser(id);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>throw<\/code>\uac00 \uc2e4\ud589\ub418\ub294 \uc21c\uac04 \ud604\uc7ac \ud568\uc218\uc758 \uc815\uc0c1\uc801\uc778 \uc2e4\ud589\uc740 \uc911\ub2e8\ub41c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GetUser() -&gt; validation \uc2e4\ud328 -&gt; throw -&gt; \ud638\ucd9c\uc790\uc5d0\uac8c \uc608\uc678 \uc804\ub2ec<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ub530\ub77c\uc11c <code>throw<\/code> \uc774\ud6c4\uc758 \ucf54\ub4dc\ub294 \uc2e4\ud589\ub418\uc9c0 \uc54a\ub294\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Test() {\n    throw new Error(\"Something went wrong\");\n\n    console.log(\"Never executed\");\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">throw\uc640 return\uc758 \ucc28\uc774<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>return<\/code>\uc740 <strong>\uc815\uc0c1\uc801\uc778 \uacb0\uacfc\ub97c \ubc18\ud658<\/strong>\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Divide(a: number, b: number) {\n    if (b === 0) {\n        return null;\n    }\n\n    return a \/ b;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ubc18\uba74 <code>throw<\/code>\ub294 <strong>\uc815\uc0c1\uc801\uc778 \uacb0\uacfc\ub97c \ubc18\ud658\ud560 \uc218 \uc5c6\ub294 \uc0c1\ud669\uc744 \uc608\uc678\ub85c \uc804\ub2ec<\/strong>\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function Divide(a: number, b: number) {\n    if (b === 0) {\n        throw new Error(\"Cannot divide by zero\");\n    }\n\n    return a \/ b;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc2e4\ubb34\uc5d0\uc11c\ub294 \ub2e4\uc74c\uacfc \uac19\uc774 \uad6c\ubd84\ud558\ub294 \uac83\uc774 \uc88b\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\uc815\uc0c1\uc801\uc778 \uacb0\uacfc -&gt; return\n\uc815\uc0c1\uc801\uc778 \uacb0\uacfc\uac00 \uc874\uc7ac\ud558\uc9c0 \uc54a\ub294 \uc608\uc678 \uc0c1\ud669 -&gt; throw<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">try \/ catch\uc640 \ud568\uaed8 \uc0ac\uc6a9<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>throw<\/code>\ub85c \ubc1c\uc0dd\uc2dc\ud0a8 \uc608\uc678\ub294 \uc0c1\uc704 \ud638\ucd9c\uc790\uc758 <code>catch<\/code>\uc5d0\uc11c \ucc98\ub9ac\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetUser(id: number) {\n    if (id &lt;= 0) {\n        throw new Error(\"Invalid user id\");\n    }\n\n    return FindUser(id);\n}\n\ntry {\n    const user = GetUser(-1);\n} catch (error) {\n    console.error(error);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc911\uc694\ud55c \uc810\uc740 <strong>\uc5d0\ub7ec\ub97c \ubc1c\uc0dd\uc2dc\ud0a4\ub294 \ucf54\ub4dc\uc640 \uc5d0\ub7ec\ub97c \ucc98\ub9ac\ud558\ub294 \ucf54\ub4dc\ub97c \ubd84\ub9ac\ud560 \uc218 \uc788\ub2e4\ub294 \uac83<\/strong>\uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GetUser() -&gt; throw\n             |\n             v\n         Service Layer\n             |\n             v\n         Controller\n             |\n             v\n           catch<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\uc2e4\ubb34\uc5d0\uc11c\ub294 \uc5b4\ub514\uc11c throw\ud558\ub294\uac00<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uac00\uc7a5 \uc77c\ubc18\uc801\uc778 \uc704\uce58\ub294 <strong>\uac80\uc99d \ub2e8\uacc4\uc640 \ube44\uc988\ub2c8\uc2a4 \ub85c\uc9c1<\/strong>\uc774\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\uc785\ub825\uac12 \uac80\uc99d<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>function CreateUser(name: string) {\n    if (!name || name.trim().length === 0) {\n        throw new Error(\"User name is required\");\n    }\n\n    \/\/ User \uc0dd\uc131\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc798\ubabb\ub41c \uc785\ub825\uc744 \ubc1c\uacac\ud55c \ud568\uc218\uc5d0\uc11c \uc989\uc2dc \uc911\ub2e8\ud55c\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\uc874\uc7ac\ud558\uc9c0 \uc54a\ub294 \ub370\uc774\ud130<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetUser(userId: number) {\n    const user = userRepository.findById(userId);\n\n    if (!user) {\n        throw new Error(\"User not found\");\n    }\n\n    return user;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774\ub807\uac8c \ud558\uba74 \uc0c1\uc704 \uacc4\uce35\uc5d0\uc11c\ub294 <code>user<\/code>\uac00 \uc5c6\uc744 \uac00\ub2a5\uc131\uc744 \uacc4\uc18d \uac80\uc0ac\ud560 \ud544\uc694\uac00 \uc5c6\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\uad8c\ud55c \uac80\uc99d<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>function DeletePost(user: User, post: Post) {\n    if (post.authorId !== user.id) {\n        throw new Error(\"Permission denied\");\n    }\n\n    postRepository.delete(post.id);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ube44\uc988\ub2c8\uc2a4 \uaddc\uce59\uc744 \uc704\ubc18\ud55c \uacbd\uc6b0 \uc608\uc678\ub97c \ubc1c\uc0dd\uc2dc\ud0a8\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Custom Error \uc0ac\uc6a9<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uc2e4\ubb34\uc5d0\uc11c\ub294 <code>Error<\/code> \ud558\ub098\ub9cc \uc0ac\uc6a9\ud558\ub294 \uac83\ubcf4\ub2e4 <strong>\uc5d0\ub7ec \uc885\ub958\ub97c \uad6c\ubd84\ud558\ub294 \uac83<\/strong>\uc774 \uc720\ub9ac\ud558\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class NotFoundError extends Error {\n    constructor(message: string) {\n        super(message);\n        this.name = \"NotFoundError\";\n    }\n}\n\nclass ValidationError extends Error {\n    constructor(message: string) {\n        super(message);\n        this.name = \"ValidationError\";\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetUser(id: number) {\n    if (id &lt;= 0) {\n        throw new ValidationError(\"Invalid user id\");\n    }\n\n    const user = FindUser(id);\n\n    if (!user) {\n        throw new NotFoundError(\"User not found\");\n    }\n\n    return user;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uadf8\ub9ac\uace0 \uc0c1\uc704 \uacc4\uce35\uc5d0\uc11c \uc885\ub958\uc5d0 \ub530\ub77c \ucc98\ub9ac\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    const user = GetUser(id);\n} catch (error) {\n    if (error instanceof ValidationError) {\n        \/\/ \uc798\ubabb\ub41c \uc694\uccad\n    }\n    else if (error instanceof NotFoundError) {\n        \/\/ \ub370\uc774\ud130 \uc5c6\uc74c\n    }\n    else {\n        \/\/ \uc608\uc0c1\ud558\uc9c0 \ubabb\ud55c \uc11c\ubc84 \uc624\ub958\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774 \ubc29\uc2dd\uc740 \uc11c\ubc84 \uac1c\ubc1c\uc5d0\uc11c \ud2b9\ud788 \uc720\uc6a9\ud558\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">HTTP API\uc5d0\uc11c\uc758 \ud65c\uc6a9<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Node.js \uc11c\ubc84\uc5d0\uc11c\ub294 <code>throw<\/code>\ub97c \uc774\uc6a9\ud574 Service \uacc4\uce35\uc5d0\uc11c \uc624\ub958\ub97c \ubc1c\uc0dd\uc2dc\ud0a4\uace0, Controller \ub610\ub294 Middleware\uc5d0\uc11c HTTP \uc751\ub2f5\uc73c\ub85c \ubcc0\ud658\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>async function GetUser(userId: number) {\n    const user = await userRepository.findById(userId);\n\n    if (!user) {\n        throw new NotFoundError(\"User not found\");\n    }\n\n    return user;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Controller\uc5d0\uc11c\ub294 \uc9c1\uc811 \ube44\uc988\ub2c8\uc2a4 \ub85c\uc9c1\uc744 \ucc98\ub9ac\ud558\uc9c0 \uc54a\uace0 \uc608\uc678\ub97c \uc804\ub2ec\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    const user = await userService.GetUser(userId);\n\n    res.json(user);\n} catch (error) {\n    next(error);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uadf8\ub9ac\uace0 \uc804\uc5ed Error Middleware\uc5d0\uc11c \ucc98\ub9ac\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.use((error, req, res, next) =&gt; {\n    if (error instanceof NotFoundError) {\n        return res.status(404).json({\n            message: error.message\n        });\n    }\n\n    if (error instanceof ValidationError) {\n        return res.status(400).json({\n            message: error.message\n        });\n    }\n\n    res.status(500).json({\n        message: \"Internal Server Error\"\n    });\n});<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uad6c\uc870\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Request -&gt; Controller -&gt; Service -&gt; Repository\n                         |\n                         v\n                       throw\n                         |\n                         v\n                 Error Middleware\n                         |\n                         v\n                    HTTP Response<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774\ub807\uac8c \uad6c\uc131\ud558\uba74 \uac01 \uacc4\uce35\uc758 \ucc45\uc784\uc774 \uba85\ud655\ud574\uc9c4\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">throw\ub97c \ub0a8\ubc1c\ud558\uba74 \uc548 \ub418\ub294 \uc774\uc720<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ubaa8\ub4e0 \uc0c1\ud669\uc744 <code>throw<\/code>\ub85c \ucc98\ub9ac\ud558\ub294 \uac83\ub3c4 \uc88b\uc740 \uc124\uacc4\ub294 \uc544\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc608\ub97c \ub4e4\uc5b4 \ub2e8\uc21c\ud788 \uac80\uc0c9 \uacb0\uacfc\uac00 \uc5c6\ub294 \uac83\uc774 \uc815\uc0c1\uc801\uc778 \uc0c1\ud669\uc774\ub77c\uba74:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function FindUsers(): User&#91;] {\n    return &#91;];\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ucc98\ub7fc \ube48 \ubc30\uc5f4\uc744 \ubc18\ud658\ud558\ub294 \uac83\uc774 \uc801\uc808\ud558\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ubc18\uba74 <strong>\ubc18\ub4dc\uc2dc \uc874\uc7ac\ud574\uc57c \ud558\ub294 \ub370\uc774\ud130\uac00 \uc5c6\ub294 \uc0c1\ud669<\/strong>\uc774\ub77c\uba74:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function GetRequiredUser(id: number): User {\n    const user = FindUser(id);\n\n    if (!user) {\n        throw new NotFoundError(\"User not found\");\n    }\n\n    return user;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ucc98\ub7fc \uc608\uc678\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 \uc801\uc808\ud558\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud575\uc2ec\uc740 \uc774\uac83\uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\uc815\uc0c1\uc801\uc778 \uc0c1\ud0dc\uc758 \ubc94\uc704 -&gt; return\n\uc815\uc0c1\uc801\uc778 \uc0c1\ud0dc\ub97c \ubc97\uc5b4\ub09c \uc0c1\ud669 -&gt; throw<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">throw\uc640 \ub85c\uadf8\ub97c \uac19\uc774 \uc0ac\uc6a9\ud558\uc9c0 \ub9d0 \uac83<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\uc74c\uacfc \uac19\uc740 \ucf54\ub4dc\ub294 \ud754\ud788 \ubc1c\uc0dd\ud558\ub294 \uc548 \uc88b\uc740 \ud328\ud134\uc774\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    DoSomething();\n} catch (error) {\n    console.error(error);\n    throw error;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ubaa8\ub4e0 \uacc4\uce35\uc5d0\uc11c \ub85c\uadf8\ub97c \ucc0d\uc73c\uba74 \ub3d9\uc77c\ud55c \uc5d0\ub7ec\uac00 \uc911\ubcf5 \uae30\ub85d\ub420 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Repository -&gt; log\nService    -&gt; log\nController -&gt; log\nMiddleware -&gt; log<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uacb0\uacfc\uc801\uc73c\ub85c \ud558\ub098\uc758 \uc624\ub958\uac00 \uc5ec\ub7ec \ubc88 \uae30\ub85d\ub41c\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc77c\ubc18\uc801\uc73c\ub85c\ub294 <strong>\ucc98\ub9ac\ud560 \uc218 \uc788\ub294 \uacc4\uce35\uc5d0\uc11c \ucc98\ub9ac\ud558\uace0, \ucd5c\uc885\uc801\uc73c\ub85c \ucc98\ub9ac\ub418\uc9c0 \uc54a\uc740 \uc608\uc678\ub97c \uc911\uc559\uc5d0\uc11c \uae30\ub85d<\/strong>\ud558\ub294 \ubc29\uc2dd\uc774 \uae54\ub054\ud558\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    await service.Execute();\n} catch (error) {\n    next(error);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uadf8\ub9ac\uace0 \uc804\uc5ed Error Handler\uc5d0\uc11c \ub85c\uadf8\ub97c \ub0a8\uae34\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">throw\ud560 \ub54c \uc5d0\ub7ec \uc815\ubcf4\ub97c \uc783\uc9c0 \uc54a\uae30<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\uc74c\ucc98\ub7fc \uc6d0\ub798 \uc5d0\ub7ec\ub97c \ubc84\ub9ac\ub294 \uac83\ub3c4 \uc88b\uc9c0 \uc54a\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    await database.query();\n} catch (error) {\n    throw new Error(\"Database error\");\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc6d0\ub798 \ubc1c\uc0dd\ud55c \uc5d0\ub7ec\uc758 \uc6d0\uc778\uc774 \uc0ac\ub77c\uc9c4\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uac00\ub2a5\ud558\uba74 \uc6d0\uc778\uc744 \ubcf4\uc874\ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try {\n    await database.query();\n} catch (error) {\n    throw new Error(\"Database error\", {\n        cause: error\n    });\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc774\ub807\uac8c \ud558\uba74 \uc0c1\uc704 \uacc4\uce35\uc5d0\uc11c <strong>\uc0c8\ub85c\uc6b4 \uc758\ubbf8\uc758 \uc5d0\ub7ec\ub97c \ub9cc\ub4e4\uba74\uc11c \uc6d0\ub798 \uc6d0\uc778\ub3c4 \uc720\uc9c0<\/strong>\ud560 \uc218 \uc788\ub2e4.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\uc2e4\ubb34\uc5d0\uc11c\uc758 \ud575\uc2ec \uc6d0\uce59<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>throw<\/code>\ub294 \ub2e8\uc21c\ud55c \uc5d0\ub7ec \ucd9c\ub825 \ubb38\ubc95\uc774 \uc544\ub2c8\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\ud604\uc7ac \uacc4\uce35\uc5d0\uc11c \uc815\uc0c1\uc801\uc778 \ucc98\ub9ac\ub97c \uacc4\uc18d\ud560 \uc218 \uc5c6\ub2e4\ub294 \uc0ac\uc2e4\uc744 \uc0c1\uc704 \uacc4\uce35\uc5d0 \uc804\ub2ec\ud558\ub294 \uc81c\uc5b4 \ud750\ub984<\/strong>\uc774\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uc2e4\ubb34\uc5d0\uc11c\ub294 \ub2e4\uc74c \uc815\ub3c4\ub97c \uae30\uc900\uc73c\ub85c \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\uc785\ub825 \uac80\uc99d \uc2e4\ud328 -&gt; throw ValidationError\n\uad8c\ud55c \ubd80\uc871 -&gt; throw AuthorizationError\n\ub370\uc774\ud130 \uc5c6\uc74c -&gt; throw NotFoundError\n\ube44\uc988\ub2c8\uc2a4 \uaddc\uce59 \uc704\ubc18 -&gt; throw BusinessError\n\uc678\ubd80 \uc2dc\uc2a4\ud15c \uc2e4\ud328 -&gt; \uc6d0\uc778 \ubcf4\uc874 \ud6c4 throw\n\uc608\uc0c1\ud558\uc9c0 \ubabb\ud55c \uc624\ub958 -&gt; \uc0c1\uc704 \uacc4\uce35\uc73c\ub85c \uc804\ub2ec\n\ucd5c\uc885 \uc608\uc678 \ucc98\ub9ac -&gt; Global Error Handler<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ud2b9\ud788 \uc11c\ubc84 \uad6c\uc870\uc5d0\uc11c\ub294 <code>throw<\/code> \uc790\uccb4\ubcf4\ub2e4 <strong>\uc5b4\ub514\uc5d0\uc11c \ubc1c\uc0dd\uc2dc\ud0a4\uace0 \uc5b4\ub514\uc5d0\uc11c \ucd5c\uc885 \ucc98\ub9ac\ud560 \uac83\uc778\uac00<\/strong>\uac00 \ub354 \uc911\uc694\ud558\ub2e4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Service -&gt; throw -&gt; Controller\/Middleware -&gt; Global Error Handler<\/code> \uad6c\uc870\ub97c \uc7a1\uc544\ub450\uba74 \uc608\uc678 \ucc98\ub9ac\uac00 \uc77c\uad00\ub418\uace0, \ube44\uc988\ub2c8\uc2a4 \ub85c\uc9c1\uacfc HTTP \uc751\ub2f5 \ucc98\ub9ac\ub3c4 \ubd84\ub9ac\ud560 \uc218 \uc788\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>throw\ub294 \ud504\ub85c\uadf8\ub7a8 \uc2e4\ud589 \uc911 \ubc1c\uc0dd\ud55c \uc608\uc678 \uc0c1\ud669\uc744 \ud638\ucd9c\uc790\uc5d0\uac8c \uc804\ub2ec\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ud558\ub294 \ubb38\ubc95\uc774\ub2e4. \uc2e4\ubb34\uc5d0\uc11c\ub294 \ub2e8\uc21c\ud788 \uc5d0\ub7ec \uba54\uc2dc\uc9c0\ub97c \ucd9c\ub825\ud558\ub294 \uc6a9\ub3c4\ub85c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294\ub2e4.\uc8fc\ub85c \ud604\uc7ac \ud568\uc218\uac00 \uc815\uc0c1\uc801\uc778 \uacb0\uacfc\ub97c \ubc18\ud658\ud560 \uc218 \uc5c6\ub294 \uc0c1\ud669\uc744 \uba85\ud655\ud558\uac8c \uc54c\ub9ac\uace0, \uc0c1\uc704 \uacc4\uce35\uc5d0\uc11c \uc608\uc678\ub97c \ucc98\ub9ac\ud558\ub3c4\ub85d \ub9cc\ub4dc\ub294 \uc5ed\ud560\ub85c \uc0ac\uc6a9\ud55c\ub2e4. \uae30\ubcf8 \uc0ac\uc6a9\ubc95 throw\uac00 \uc2e4\ud589\ub418\ub294 \uc21c\uac04 \ud604\uc7ac \ud568\uc218\uc758 \uc815\uc0c1\uc801\uc778 \uc2e4\ud589\uc740 \uc911\ub2e8\ub41c\ub2e4. \ub530\ub77c\uc11c throw \uc774\ud6c4\uc758 \ucf54\ub4dc\ub294 \uc2e4\ud589\ub418\uc9c0 \uc54a\ub294\ub2e4. throw\uc640 return\uc758 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"class_list":["post-2403","post","type-post","status-publish","format-standard","hentry","category-client"],"_links":{"self":[{"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/posts\/2403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2403"}],"version-history":[{"count":1,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/posts\/2403\/revisions"}],"predecessor-version":[{"id":2404,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=\/wp\/v2\/posts\/2403\/revisions\/2404"}],"wp:attachment":[{"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wayhope.kro.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}