Skip to content

Commit 3207217

Browse files
committed
handlig errror at story
1 parent b9a4936 commit 3207217

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

app/api/story/controller.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ const folderName = 'img-story'; //nama-folder
1717
module.exports = {
1818
getAllStory: async (req, res, next) => {
1919
try {
20-
const Story = await story.findAll({
21-
// where: {
22-
// user: req.user.id,
23-
// },
24-
});
20+
const Story = await story.findAll();
2521

2622
res.status(200).json({
2723
message: 'Success get All My Story',
2824
data: Story,
2925
});
3026
} catch (error) {
31-
next(error);
27+
console.error(error);
28+
res.status(500).json({ message: 'Server error' });
3229
}
3330
},
3431
getStoryById: async (req, res, next) => {
@@ -42,7 +39,8 @@ module.exports = {
4239
data: Story,
4340
});
4441
} catch (error) {
45-
next(error);
42+
console.error(error);
43+
res.status(500).json({ message: 'Server error' });
4644
}
4745
},
4846
getDataLocationGunung: async (req, res) => {

0 commit comments

Comments
 (0)