Skip to content

Add error throw #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM node:19-alpine
ENV PORT 8080
FROM node:14-alpine


WORKDIR /usr/src/app

RUN apk add --no-cache git
COPY . .

ENV PORT 8080
EXPOSE 8080
CMD ["npm", "start", "--no-update-notifier"]
11 changes: 7 additions & 4 deletions src/repos/exampleRepo.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import mongoDBClient from '../config/mongoConfig.js';
import {makeObjectId} from "./utils/mongoDbUtils.js";

class ExampleRepo{
class ExampleRepo {

async getById(orgId){
async getById(orgId) {
if (!orgId) {
throw Error('cannot divide by zero')
}
const collectionClient = await mongoDBClient.collection("example")
return await collectionClient.findOne({
_id: makeObjectId(orgId)
return await collectionClient.findOne({
testobject_id: makeObjectId(orgId)
});
}
}
Expand Down
Loading